Page 1 of 1

linker errors with edgemain.h

PostPosted: Dec 4, 2007 @ 12:16am
by ThursdayNext
Because of the way my code is written I need to #include edgemain.h in multiple files. This results in a slew of linker errors saying that all of the edgelib methods were already defined in the first .cpp file that included edgemain.h

e.g.

GamGameTaskFactory.obj : warning LNK4006: "bool __cdecl EdgeGL_Use(void)" (?EdgeGL_Use@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored
GamGameTaskFactory.obj : warning LNK4006: "bool __cdecl EdgeGL_FixedPoint(void)" (?EdgeGL_FixedPoint@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored
GamGameTask.obj : warning LNK4006: "bool __cdecl EdgeGL_Use(void)" (?EdgeGL_Use@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored
GamGameTask.obj : warning LNK4006: "bool __cdecl EdgeGL_FixedPoint(void)" (?EdgeGL_FixedPoint@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored
Game.obj : warning LNK4006: "bool __cdecl EdgeGL_Use(void)" (?EdgeGL_Use@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored
Game.obj : warning LNK4006: "bool __cdecl EdgeGL_FixedPoint(void)" (?EdgeGL_FixedPoint@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored
Background.obj : warning LNK4006: "bool __cdecl EdgeGL_Use(void)" (?EdgeGL_Use@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored
Background.obj : warning LNK4006: "bool __cdecl EdgeGL_FixedPoint(void)" (?EdgeGL_FixedPoint@@YA_NXZ) already defined in Splashscreen.obj; second definition ignored

Further investigation showed the problem to be that executable code was being included in the .h files without being defined as inline

Am I not using the edgemain.h file correctly? Is this intentional?

PostPosted: Dec 4, 2007 @ 12:59pm
by edge
Hi,

If you have multiple .cpp files, you include edgemain.h for the file containing the EdgeMain() function. For the other files you can include edge.h directly. This way, the linker errors will disappear.