[Solved] error LNK2005: “void * __cdecl operator new(unsigned int)” (??2@YAPAXI@Z) already in LIBCMTD.lib(new.obj)

Error:

uafxcw.lib(afxmem.obj) : error LNK2005: “void * __cdecl operator new(unsigned int)” (??2@YAPAXI@Z) already defined in LIBCMT.lib(new.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: “void __cdecl operator delete(void *)” (??3@YAXPAX@Z) already defined in LIBCMT.lib(delete.obj)
uafxcw.lib(afxmem.obj) : error LNK2005: “void * __cdecl operator new[](unsigned int)” (??_U@YAPAXI@Z) already defined in LIBCMT.lib(new2.obj)

Pro-tested solutions available.

Specific solution: (see the last link for another solution, I have not tested it)

In the vs2010 project settings [Linker] – [input] – [additional dependencies] chase nafxcw.lib, libcmt.lib, Debug, append Nafxcwd.lib, libcmtd.lib.

Compile again passed, but with

LINK : warning LNK4098: defaultlib ‘uafxcw.lib’ conflicts with use of other libs; use /NODEFAULTLIB: library

Append uafxcw.lib or the Debugg version of uafxcwd.lib to [Linker] – [input] – [Ignore specific library].

Similar Posts: