MenuStateS.obj : error LNK2005: "int (* raycastclose)[2]" (?raycastclose@@3PAY01HA) already defined in main11.obj
1>MenuStateS.obj : error LNK2005: "int (* raycast)[2]" (?raycast@@3PAY01HA) already defined in main11.obj
1>MenuStateS.obj : error LNK2005: "void __cdecl collisioneffectdamage(class sf::Sprite &,float,float,float,float,float,float,float,float,int &,int &)" (?collisioneffectdamage@@YAXAAVSprite@sf@@MMMMMMMMAAH1@Z) already defined in main11.obj
1>MenuStateS.obj : error LNK2005: "void __cdecl collisioneffectpushback(class sf::Sprite &,float,float,float,float,float,float,float,float)" (?collisioneffectpushback@@YAXAAVSprite@sf@@MMMMMMMM@Z) already defined in main11.obj
1>MenuStateS.obj : error LNK2005: "void __cdecl DealExplosion(class sftools::Animated &)" (?DealExplosion@@YAXAAVAnimated@sftools@@@Z) already defined in main11.obj
I think it might be something like a file or library included twice or a similar problem. What sort of things usually cause these type of errors?
linker errors
I'm getting a ton of linker errors for C++ VS2008 like these
It sounds like you have non-extern global variable definitions and non-inline function definitions in one or more of your header files. To fix, make sure that only extern declarations for global variables are in the header and that they are defined properly in a source file and that any functions defined in headers are explicitly or implicitly inlined. More details.
I seem to remember getting those when I define functions in the header files.
In general you should only have declarations in your header files and keep the definitions in source files.
In addition to that you might want to make sure you use inclusion guards in all your header files
edit:
SiCrane beat me to it, and explained to better as well
In general you should only have declarations in your header files and keep the definitions in source files.
In addition to that you might want to make sure you use inclusion guards in all your header files
#define SOME_QNIQUE_LABELDeclarations here...#endif
edit:
SiCrane beat me to it, and explained to better as well
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement