I'm trying to compile a C++ program, written using Visual C++ 2005 and MFC, in MS VS 2010. Sadly I'm getting the following error during compilation:
Error 2 error LNK2005: "public: virtual __thiscall CMemDC::~CMemDC(void)" (??1CMemDC@@UAE@XZ) already defined in CMemDCImpl.obj Project\Project\Project\uafxcwd.lib(afxglobals.obj) Project.
CMemDCImpl has a header file which contains definitions of all members of the class CMemDCImpl, and *.cpp file with their implementations. Please help me to fix this error.
You mention that you CMemDCImpl is defined in a cpp file. However, it also seems to be defined in uafxcwd.lib (a library you apparently use). I can think of two possibilities for this error:
.
namespace Foo
{
class CMemDC
{
// ...
};
}
// Usage:
Foo::CMemDC myMemDC;
Without the actual code, we can only guess. Most likely you have done one of these:
CMemDC::~CMemDC() {}
twice, maybe a copy-paste that you didn't rename to CMemDCImpl::~CMemDCImpl()
CMemDC::~CMemDC()
in a header file after CMemDC
class definition instead of in the class definition Solution I use : rename the well known and well used CMemDC class in something as CMemDc
because Microsoft crushed it and Keith or ourselves have not copyrighted it ?!?
in vs2k10 Microsoft dared to crush the name of the CMemDC class of Keith, with some shit.
Yesterday born Microsoft guys : this it's one of the most popular classes that everyone uses since 1997! Gross! Shame on you, Microsoft !
CMemDc - memory DC
// Author: Keith Rule
// Email: keithr@europa.com
// Copyright 1996-1997, Keith Rule
Thank You Keith ! Those "new" and "catastrophic" guys of "the after-Gates" want us to change every "CMemDC" in every sources we have.. What a shame
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.