Advertisement

directx and linker errors

Started by March 05, 2002 10:47 PM
2 comments, last by flucknugget 22 years, 6 months ago
I''m trying to compile a DirectX program, and after I finished debugging the last error and tried compiling, I suddenly got 22 new errors, and they''re all linker errors. I have the directx directories set, and all I''m using is DirectDraw (I''m using DX7), and ddraw.lib is included in the settings (I''m using MSVC++ 6). I #included and everything, and I have no idea why all these errors are here. They''re all saying that things are already defined in main.obj (the file with WinMain in it is called main.cpp). Here are examples of a couple of the errors. What am I missing? game.obj : error LNK2005: "struct IDirectDrawClipper * lpddclipper" (?lpddclipper@@3PAUIDirectDrawClipper@@A) already defined in main.obj game.obj : error LNK2005: "struct IDirectDrawPalette * lpddpal" (?lpddpal@@3PAUIDirectDrawPalette@@A) already defined in main.obj game.obj : error LNK2005: "struct IDirectDrawSurface7 * lpddsback" (?lpddsback@@3PAUIDirectDrawSurface7@@A) already defined in main.obj game.obj : error LNK2005: "struct IDirectDrawSurface7 * lpddsprimary" (?lpddsprimary@@3PAUIDirectDrawSurface7@@A) already defined in main.obj game.obj : error LNK2005: "struct IDirectDraw7 * lpdd" (?lpdd@@3PAUIDirectDraw7@@A) already defined in main.obj - fluckypoo - the geek inside
- f l u c k y p o o
I''ve gotten errors like that before. It happened when more than one include file #include''d the same library; I guess the stupid linker wanted to link it twice and rather than assume I only want one copy, decided to die. The only solution I could come up with (in two seconds which was about all I was willing to give the problem) was to merge header files which need to refernce the same dll. If anyone has a better solution I would love to hear it because mine sucks for large projects!
Advertisement
Do you have your library files included in the project correctly?
i figured it out. i had all the right libraries included, i was just using multiple files and not making my global variables extern. all my globals just happened to be directx variables.


- f l u c k y p o o
- the geek inside
- f l u c k y p o o

This topic is closed to new replies.

Advertisement