Sign in to follow this  
moucard

linker error when adding a direct play class

Recommended Posts

moucard    161
Hello again to everyone. I've (hopefully) succesfully compiled my project adding a new CNet class which tries to encapsulate DirectPlay for some simple peer 2 peer communication, with one app acting as host and the other as client. The CNet is a patchwork of the examples from the directx 9.0 sdk. Not a beautifull site, and not very informative (the documentation). A diagram would help a lot. Anyway, the problem is when I try to #include the file "CNet.h" in another class to use it. I get linker errors like this:
main.obj : error LNK2005: _CLSID_DP8SP_BLUETOOTH already defined in CNet.obj
main.obj : error LNK2005: _CLSID_DP8SP_TCPIP already defined in CNet.obj
main.obj : error LNK2005: _CLSID_DP8SP_SERIAL already defined in CNet.obj
Reading the documentation, it says that the most common cause is linking with both the single and multi threaded libraries. Which libraries are these? If anyone has any previous experience please help! Thank you for your time.

Share this post


Link to post
Share on other sites
moucard    161
Ok, I've removed the #define INITGUID directive and linked directly with dxguid.lib. This removed almost all linker errors exept this one:

Trace.obj : error LNK2005: "struct _GUID GUID_CoucouCacheGame" (?GUID_CoucouCacheGame@@3U_GUID@@A) already defined in CGame.obj
Main.obj : error LNK2005: "struct _GUID GUID_CoucouCacheGame" (?GUID_CoucouCacheGame@@3U_GUID@@A) already defined in CGame.obj
CNet.obj : error LNK2005: "struct _GUID GUID_CoucouCacheGame" (?GUID_CoucouCacheGame@@3U_GUID@@A) already defined in CGame.obj
Debug/Game.exe : fatal error LNK1169: one or more multiply defined symbols found

The GUID_CoucouCacheGame is a global variable defined in the CNet.h file like this:

GUID GUID_CoucouCacheGame = {0x6b455f69, 0xd93e, 0x4484, {0x91, 0xc1, 0x84, 0x97, 0x20, 0x7f, 0x0, 0x25}};

Anyone having any ideas?
PS: The three .obj files that seem to produce the error are the one that the variable propagates. Main.obj includes Game.h, Game.h includes Trace.h, Trace includes CNet.h Interesting though that I don't get a linker error for CGame.obj

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this