This site is no longer active and is available for archival purposes only. Registration and login is disabled.

linker errors with edgemain.h


linker errors with edgemain.h

Postby ThursdayNext » Dec 4, 2007 @ 12:16am

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?
ThursdayNext
pm Member
 
Posts: 9
Joined: Oct 26, 2007 @ 6:25pm


Postby edge » Dec 4, 2007 @ 12:59pm

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.
EDGELIB: Cross-platform mobile development at your fingertips
http://www.edgelib.com
User avatar
edge
pm Member
 
Posts: 1180
Joined: Aug 22, 2005 @ 3:42pm
Location: The Netherlands


Return to EDGELIB


Sort


Forum Description

Powerful and affordable C++ middleware solution covering true multi-platform 2D, 3D and network features for Apple iPhone, Windows Mobile, Symbian S60, UIQ, Linux and Windows desktop.

Moderator:

edge

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron