Recently, while working on VC 6.0, I encountered a very annoying error in several places. The following error occurs: Linking... nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib( new.obj) nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj) Debug/DCap. exe: fatal error LNK1169: one or more multiply defined symbols found Solution: For such an error, it is obvious that both linked libraries provide functions with the same name. But of course it is not possible to directly ignore LIBCMTD.lib, because it is a C library. The reason why this problem occurs is because MFC's library conflicts with C's library, and the order in which they are linked must be set, that is, nafxcwd.lib first and then LIBCCMTD.lib. But both of them are default libraries, so how to set their order? Solution: Ignore them first, and then add them additionally. That is to say: Enter: nafxcwd.lib libcmtd.lib in Ignore Libraries on the Link tab, then enter: nafxcwd.lib libcmtd.lib in Object/library modules on the same tab. In this way, the order in which they are added becomes the order we are forced to set. ?
Expand