Skip to content

Commit 3183035

Browse files
authored
Fix duplicate raymath symbols in modules (#435)
* Fix duplicate raymath symbols in modules * Remove unneeded comments
1 parent d2cc1a4 commit 3183035

3 files changed

Lines changed: 10 additions & 4 deletions

File tree

‎examples/module/main.cpp‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,27 @@
1010
import raylib;
1111

1212
using raylib::Color;
13+
using raylib::Vector2;
1314
using raylib::Window;
1415

1516
int main() {
1617
int screenWidth = 800;
1718
int screenHeight = 450;
1819

20+
// Mixing raymath with raylib runtime calls must not produce duplicate symbols when linking against raylib.
21+
Vector2 textPosition = Vector2(100, 180) + Vector2(20, 20);
22+
1923
Window window(screenWidth, screenHeight, "raylib-cpp - modules example");
2024

2125
while (!window.ShouldClose()) {
2226
window.BeginDrawing();
2327
window.ClearBackground(raylib::Colors::RAYWHITE);
24-
raylib::DrawText("Congrats! You imported raylib as a module!", 120, 200, 20, Color::LightGray());
28+
raylib::DrawText(
29+
"Congrats! You imported raylib as a module!",
30+
static_cast<int>(textPosition.x),
31+
static_cast<int>(textPosition.y),
32+
20,
33+
Color::LightGray());
2534
window.EndDrawing();
2635
}
2736

‎include/raymath.hpp‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@
88
extern "C" {
99
#endif
1010
#ifndef RAYLIB_CPP_NO_MATH
11-
#ifndef BUILD_RAYLIB_CPP_MODULES
1211
#ifndef RAYMATH_STATIC_INLINE
1312
#define RAYMATH_STATIC_INLINE
1413
#endif
15-
#endif
1614
#ifdef __GNUC__
1715
#pragma GCC diagnostic push // These throw a warnings on visual studio, need to check if __GNUC__ is defined to use it.
1816
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"

‎modules/raylib.cppm‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ module;
99

1010
#define BUILD_RAYLIB_CPP_MODULES
1111
#define RLCPPAPI
12-
#define RAYMATH_IMPLEMENTATION
1312
#include "../include/raylib-cpp.hpp"
1413

1514
#undef LIGHTGRAY

0 commit comments

Comments
 (0)