Microsoft Visual C++ and class redefination
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
}
A) LoadBitmap is a function defined by the Win32 API. Choose another name.
B) Zelda is a name defined by Nintendo. Choose another name
B) Zelda is a name defined by Nintendo. Choose another name
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement