-
LINK2005
Hi,
i have this link error only when i compile my project in release mode. The debug mode is ok.
My project (.exe) must link many lib together, all lib compile correctly in release mode.
The code generation is the same for all, MultiThreadDll.
The error :
nafxcw.lib(strcore.obj) : error LNK2005: "public: __thiscall CString::CString(class CString const &)" (??0CString@@QAE@ABV0@@Z) already defined in mfc42.lib(MFC42.DLL)
great thanks in advance
Carl
-
Carl,
I've run into this before. The thing is that different DLLs are used by the release and debug versions.
What you have to do is to ignore the nafxcw.lib library in your release build.
I Visual Studio.NET (VC 7) make sure on the right side you have solution explorer selected. Right click on the appropriate project, choose properties, choose linker, choose input and in ignore specific library type in this library name. (nafxcw.lib) You may have to repeat this step as more may show up.
In VC6 choose menu option project / setting. Go to link tab. Choose category Input. In the Ignore Libraries edit box put nafxcw.lib. Once again realize that you may have to add more than one.
Gary
-
See if you have projects that use libraries linked statically with MFC and libraries that use MFC as dynamic (shared) libraries you most likely will have this problem. I do not think that ignoring some will fix your problem.
If you can re-link all libraries to use the same type of linkage.