nafxcwd.lib和afxmem.obj的衝突

>------ Build started: Project: ReplaceOther, Configuration: Debug Win32 ------
1>Linking...
1>ImageTagInfo.obj : warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/INCREMENTAL:NO' specification
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new[](unsigned int)" (??_U@YAPAXI@Z) already defined in LIBCMTD.lib(new2.obj)
1>nafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete[](void *)" (??_V@YAXPAX@Z) already defined in LIBCMTD.lib(delete2.obj)
1>../../../test/ReplaceOther/Debug/ReplaceOther.exe : fatal error LNK1169: one or more multiply defined symbols found
1>Build log was saved at "file://d:/Decompiler/DecWorkspace/SWFLib/test/ReplaceOther/Debug/BuildLog.htm"
1>ReplaceOther - 5 error(s), 1 warning(s)
========== Build: 0 succeeded, 1 failed, 6 up-to-date, 0 skipped ==========

今天在編寫一個小的測試工程的時候,發現了一個由於nafxcwd.lib和afxmem.obj引起的衝突。在MS的文檔中找到了一點答案:http://support.microsoft.com/kb/148652/zh-cn

 

libcmtd.lib對應調試版多線程靜態C標準庫, msvcrtd.lib對應調試版本多線程動態C標準庫,nafxcwd.lib對應MFC靜態連接庫

 

所以在項目屬性的Linker-》Input面板中的Addtional dependency中添加上:nafxcwd.lib,這樣問題就解決了。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章