If you are compiling an MFC program, the following and similar errors occur:
1>uafxcwd.lib (afxmem.obj): Error LNK2005: "void * __cdecl operator new (unsigned int)" ([email protected]@z] already in LIBCMT Defined in D.lib (new.obj)
1>uafxcwd.lib (afxmem.obj): Error LNK2005: "Void __cdecl operator delete (void *)" ([email protected]@z] already in LIBCMTD.lib (dbgdel.obj) defined in
1>uafxcwd.lib (afxmem.obj): Error LNK2005: "void * __cdecl operator new[] (unsigned int)" ([email protected]@z) already in libc Defined in Pmtd.lib (newaop.obj)
1>uafxcwd.lib (afxmem.obj): Error LNK2005: "Void __cdecl operator delete[] (void *)" ([email protected]@z] already in LIBCMTD.L Defined in IB (Delete2.obj)
Here's how to fix it:
Project Properties page-linker-Input
Make the following changes, note the order
Additional dependent libraries: uafxcwd.lib; LIBCMTD.lib;
Ignore specific default libraries: Libcmtd.lib;uafxcwd.lib
Uafxcwd.lib (afxmem.obj): Error LNK2005: "void * __cdecl operator new (unsigned int)" Workaround