Need help with ddutil.cpp

Started by
4 comments, last by IronMan 22 years, 9 months ago
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 .............................
.............................
Advertisement
that thing never worked for me I dunno what to say.

Eric Wright o0Programmer0o
AcidRain Productions
http://www.acidrainproductions.com
Eric Wright o0Programmer0o
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

  Downloads:  ZeroOne Realm

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


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

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

  Downloads:  ZeroOne Realm

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
-----------------------------kevin@mayday-anime.comhttp://www.mayday-anime.com

This topic is closed to new replies.

Advertisement