• Advertisement

Archived

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

Microsoft Visual C++ and class redefination

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am compiling with microsoft Visual c++ 6.0 and trying to use classes. I went through all the hoops creating the classes throught the "new class" feature and have included both .cpp and .h in my project. When i try to compile i come up with these linking errors. Any feedback would be greatly appreciated. myAttemp.obj : error LNK2005: "public: __thiscall LoadBitmapA::LoadBitmapA(void)" (??0LoadBitmapA@@QAE@XZ) already defined in LoadBitmap.obj myAttemp.obj : error LNK2005: "public: virtual __thiscall LoadBitmapA::~LoadBitmapA(void)" (??1LoadBitmapA@@UAE@XZ) already defined in LoadBitmap.obj myAttemp.obj : error LNK2005: "public: long __thiscall LoadBitmapA::LoadFromBitmap(char *)" (?LoadFromBitmap@LoadBitmapA@@QAEJPAD@Z) already defined in LoadBitmap.obj Debug/Zelda.exe : fatal error LNK1169: one or more multiply defined symbols found LoadBitmap::LoadBitmap() { width = 0; height = 0; imageBuffer = NULL; } LoadBitmap::~LoadBitmap() { width = 0; height = 0; if(NULL != imageBuffer) { delete [] imageBuffer; imageBuffer = NULL; } } /*LoadBitmap & LoadBitmap::operator = (LoadBitmap & image) { width = image.GetWidth(); height = image.GetHeight(); SetImageBuffer(image.GetImageBuffer()); return * this; }*/ HRESULT LoadBitmap::LoadFromBitmap(LPSTR filename) { this code was taken out because it was too long and it was a redefiniton linking error anyway }

Share this post


Link to post
Share on other sites
Advertisement
A) LoadBitmap is a function defined by the Win32 API. Choose another name.

B) Zelda is a name defined by Nintendo. Choose another name

Share this post


Link to post
Share on other sites

  • Advertisement