Archived

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

IronMan

Need help with ddutil.cpp

Recommended Posts

hey,i am trying to use the DDLoadBitmap() function from the ddutil.cpp file,but whenever i try linking,it pulls up 7 erros,it says that DDLoadBitmap is already defined in the main.obj. Linking... ddutil.obj : error LNK2005: _DDLoadBitmap already defined in Main.obj ddutil.obj : error LNK2005: _DDReLoadBitmap already defined in Main.obj ddutil.obj : error LNK2005: _DDCopyBitmap already defined in Main.obj ddutil.obj : error LNK2005: _DDLoadPalette already defined in Main.obj ddutil.obj : error LNK2005: _DDColorMatch already defined in Main.obj ddutil.obj : error LNK2005: _DDSetColorKey already defined in Main.obj Debug/BattlePong.exe : fatal error LNK1169: one or more multiply defined symbols found Error executing link.exe. BattlePong.exe - 7 error(s), 0 warning(s) how should i fix this.thanks .............................

Share this post


Link to post
Share on other sites
You have defined the ddutil.h file twice.

To fix this define ''pragma once'' in the ddutil.h file, and your own header files to avoid future problems.

At the very start of the header files add:

  
#pragma once
#ifndef __ddutil_h
#define __ddutil_h


And at the very end of the header file add:

  

#endif // __ddutil_h




  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
nope,thanks anyways,but i tried it and it didnt work.i put it at the top of the ddutil.h
and the other endif at the bottom,it didnt work.i even tried it at the top of my main.cpp and the ddutil.cpp.any thoughts.Or could you send me some code with it working.thanks


.............................

Share this post


Link to post
Share on other sites

Try removing #include "ddutil.h" from your main.h file and putting it in your main.cpp file instead (or vise-versa). Or check your other cpp and h files and remove it from them.

Otherwise if it still doesnt work, send me the project if its vc command line based (Im not running DevStudio where I am) and Ill see what I can do.

NSZeroOne@Hotmail.com

  Downloads:  ZeroOne Realm

Share this post


Link to post
Share on other sites
I have had that error happen to me before. I fixed it one of two ways:

1. I did a clean rebuild. By default Visual Studio links incrementally. This means it doesn''t completely re-compile/re-link all of the object files when building. The error coming up are because you made a change in Main.cpp and ddutil.cpp stayed the same, therefore Visual Studio is trying to re-link only main.obj and not ddutil.obj. It''s kinda dumb, but that is easiest way to clear up the problem

2. Check your header definitions. Make sure you are only including DDUTIL.H and not both DDUTIL.H and DDUTIL.CPP. I have seen this mistake before.

Other than that, maybe if we could take a look at your declarations and see if we can track down the bug.

-----------------------------
kevin@mayday-anime.com
http://dainteractive.mayday-anime.com

Share this post


Link to post
Share on other sites