#### Archived

This topic is now archived and is closed to further replies.

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

## Recommended Posts

I have a problem in compiling my DirectX Project, somehow it shows error message while it was in the lingking proccess the error was : Object3D.obj : error LNK2005: "unsigned char * D3DRM_XTEMPLATES" (?D3DRM_XTEMPLATES@@3PAEA) already defined in D3DApp.obj I don''t think I''ve encountered such a problem before, can somebody tell me why ?? my guess was I''ve overlapped the headers file but I''ve check that there''s no overlapping of the header files (I''ve never declare an object twice) As u can see that I''ve created another object inside my D3D wrappers, but i''ve tried before and it worked fine Please can somebody help me ?? Cause I''m very confuse right now ??

##### Share on other sites

Some of my projects compile with VERY strange error messages, UNLESS windows.h is the first file included...

##### Share on other sites
I have had a very similar problem with my project as well.
What I found with mine was that it was complaining about variable instances being declared in the header files. I am new to C++ and don''t know the reasons behind it, but to fix the linker problem I just declared the variable as extern and instantiated the structure in the corresponding .cpp file.
This took me a long time to track down. Hope it helps!

Steele.

(If this makes no sense, I will post my example tonight after work - don''t have access to my code from here and I don''t know enough about it to remember!) :-)

##### Share on other sites
ahhh yes the extern declaration...should''ve thought of that...

  //main.hextern HWND g_hWnd;//main.cpp#include "main.h"HWND g_hWnd = NULL;//engine1.cpp#include "main.h"//now engine1.cpp has access to the global g_hWnd variable//which is created and defined in main.cpp

hth...thanks Crowknee for the memory bump..

1. 1
Rutin
24
2. 2
3. 3
JoeJ
18
4. 4
5. 5

• 38
• 23
• 13
• 13
• 17
• ### Forum Statistics

• Total Topics
631712
• Total Posts
3001849
×