-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[config] Defining custom allocator macros in src/config.h
results in: warning: "RL_*ALLOC" redefined
#4778
Comments
So I tried to fix this by including config.h on the very top of raylib.h diff --git a/src/raylib.h b/src/raylib.h
index 7919db77..1e8aefbc 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -87,6 +87,11 @@
#include <stdarg.h> // Required for: va_list - Only used by TraceLogCallback
+// Check if config flags have been externally provided on compilation line
+#if !defined(EXTERNAL_CONFIG_FLAGS)
+ #include "config.h" // Defines module configuration flags
+#endif
+
#define RAYLIB_VERSION_MAJOR 5
#define RAYLIB_VERSION_MINOR 6
#define RAYLIB_VERSION_PATCH 0 warnings disappear but one of the examples breaks
|
@sleeptightAnsiC I prefer to avoid including |
@raysan5 What is the preferred way of defining those macros? In another file included with All raylib's sources that include raylib.h also seem to include config.h right afterwards. |
While working on other issue ( #4777 / #4776 ) I noticed that
src/raylib.h
defines "RL_*ALLOC" macros before includingsrc/config.h
(raylib.h does not include config.h at all). If someone tries to define said macros inside config.h (which seems like very reasonable place) it will result in compiler warnings about that said macros were re-defined. This may also indicate that a mismatch happens somewhere during preprocessing stage.Repro:
with the patch below applied to config.h
try to compile with Cmake or GNU Make
(this is x86_64 Linux with raylib pulled from git)
$ uname -a Linux MAL200424 6.13.2-arch1-1 #1 SMP PREEMPT_DYNAMIC Sat, 08 Feb 2025 18:54:55 +0000 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: