Problem unknown

This topic is 4996 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

Recommended Posts

I can't seem to figure out what I'm doing wrong with my code. The link to the code is http://www.users.bigpond.com/jackorang/my problem.zip . It is the start of a small game I was going to make to see what I could do with DirectX but it compiles with an error I'm not familiar with. Could you guys please download it and try it out and report to me a solution? Thanks. Below is the output window when I compile: Output Window Compiling... Main.cpp Skipping... (no relevant changes detected) SWEngine.cpp Linking... SWEngine.obj : error LNK2005: "struct IDirect3DDevice9 * g_pD3DDevice" (?g_pD3DDevice@@3PAUIDirect3DDevice9@@A) already defined in Main.obj SWEngine.obj : error LNK2005: "struct IDirect3D9 * g_pD3D" (?g_pD3D@@3PAUIDirect3D9@@A) already defined in Main.obj Debug/School Wars.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. [Edited by - Kryptus on March 16, 2005 5:51:58 AM]

Share on other sites
For starters, you could tell us the exact error message.

*starts psychic troubleshooting*
Are you linking to the proper libraries?
Do you have the DX9 SDK installed and configured?
Have your cat been eating proper lately?

Edit: Oh, you edited it in...

I would move the globals from the School Wars.h header to your SWEngine.cpp and put an extern declaration of them in the header like this:
extern LPDIRECT3DDEVICE9 g_pD3DDevice;

Share on other sites
I am linking to the correct libraries I'm sure because I can compile other DX applications. I have a link to the header <d3d9.h> and d3d9.lib and I have properly set up the links in the Tools > Options > Directories area.

Share on other sites
Hey thanks that worked well! But if I add other modules and things, will they still be able to refer to the D3D and D3DDevice objects correctly?

Share on other sites
Yeah, if you include the header file.

Share on other sites
But the references aren't in the header file so I can't include them. They are now in one of the source files.

1. 1
Rutin
42
2. 2
3. 3
4. 4
5. 5

• 9
• 27
• 20
• 14
• 14
• Forum Statistics

• Total Topics
633387
• Total Posts
3011620
• Who's Online (See full list)

There are no registered users currently online

×