error: redefinition of 'struct Vector2/3/4' #5841
-
|
Surely I'm doing something simple wrong. I just started using raylib (seems like a really decent library!), but whenever I include both Is this to be expected? Both files do in fact declare all the math types, afaict, but only In general, how should I set up my project? Many of my files only need the math types and operators, whereas a few of my files need some of the other parts of Should I only include TIA! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
|
Ok, so for my header that includes two other headers that pull in #include "raylib/raylib.h"
#include "raylib/raymath.h"This appears to have worked. Is there a reason including If this qualifies for a bug report, please let me know. Thanks! |
Beta Was this translation helpful? Give feedback.
-
|
This is intended behaviour. raylib is a standalone library, and raymath was designed to work alongside it — though it can also be used standalone. For this reason, raymath checks whether each symbol is already defined before defining it. for exemple: Lines 119 to 126 in b2ea5ea raylib doesn't do the same, and as a standalone lib, it isn't required to. It instead sets defines after declaring its types, which raymath uses to detect them: Lines 160 to 170 in b2ea5ea So the rule is: always include |
Beta Was this translation helpful? Give feedback.
This is intended behaviour.
raylib is a standalone library, and raymath was designed to work alongside it — though it can also be used standalone. For this reason, raymath checks whether each symbol is already defined before defining it. for exemple:
raylib/src/raymath.h
Lines 119 to 126 in b2ea5ea
raylib doesn't do the same, and as a standalone lib, it isn't required to. It instead sets defines after declaring its types, which raymath uses to detect them:
raylib/src/raylib.h
Lines 160 to 170 in b2ea5ea