VC缺省链接库的顺序不对导致链接错误error LNK2005: "void __cdecl operator delete(void *)"(??3@YAXPAX@Z) already defined in libcpmt.lib(delop.obj)
在编译工程UDPDriver时,MFC static Library和Code Generation/MultiThread选项时,链接总出现问题:
nafxcw.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmt.lib(delop.obj)
nafxcw.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmt.lib(delop.obj); second definition ignored
nafxcw.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in libcpmt.lib(delop.obj); second definition ignored
我个人的设置是这样的,跟网上的有点不一样(顺序不同)
1.
project setting ---gategory --input ---ignorelibries 下面添加要忽略的那两个库本例为
nafxcw.lib libcpmt.lib
2.修改连接库的顺序
project setting ---gategory --general ---object/library modules:
添加 Libcmtd.lib Nafxcwd.lib (这两个lib顺序不一样,如果还是不行 就改成
Nafxcwd.lib Libcmtd.lib )