LIBCD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCRTD.dll)

类似链接错误:

LIBCD.lib(crt0dat.obj) : error LNK2005: _exit already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCD.lib(crt0dat.obj) : error LNK2005: __exit already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCD.lib(dbgheap.obj) : error LNK2005: _malloc already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCD.lib(dbgheap.obj) : error LNK2005: _calloc already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCD.lib(dbgheap.obj) : error LNK2005: _realloc already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCD.lib(dbgheap.obj) : error LNK2005: _free already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCD.lib(crt0init.obj) : error LNK2005: ___xc_z already defined in msvcrtd.lib(cinitexe.obj)
LIBCD.lib(crt0init.obj) : error LNK2005: ___xc_a already defined in msvcrtd.lib(cinitexe.obj)
LIBCD.lib(crt0init.obj) : error LNK2005: ___xi_z already defined in msvcrtd.lib(cinitexe.obj)
LIBCD.lib(crt0init.obj) : error LNK2005: ___xi_a already defined in msvcrtd.lib(cinitexe.obj)
LIBCD.lib(mbctype.obj) : error LNK2005: __getmbcp already defined in msvcrtd.lib(MSVCRTD.dll)
LIBCD.lib(winxfltr.obj) : error LNK2005: __XcptFilter already defined in msvcrtd.lib(MSVCRTD.dll)
msvcrtd.lib(MSVCRTD.dll) : error LNK2005: __setmbcp already defined in LIBCD.lib(mbctype.obj)
LIBCD.lib(crt0dat.obj) : warning LNK4006: _exit already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBCD.lib(crt0dat.obj) : warning LNK4006: __exit already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBCD.lib(dbgheap.obj) : warning LNK4006: _malloc already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBCD.lib(dbgheap.obj) : warning LNK4006: _calloc already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBCD.lib(dbgheap.obj) : warning LNK4006: _realloc already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBCD.lib(dbgheap.obj) : warning LNK4006: _free already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBCD.lib(crt0init.obj) : warning LNK4006: ___xc_z already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBCD.lib(crt0init.obj) : warning LNK4006: ___xc_a already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBCD.lib(crt0init.obj) : warning LNK4006: ___xi_z already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBCD.lib(crt0init.obj) : warning LNK4006: ___xi_a already defined in msvcrtd.lib(cinitexe.obj); second definition ignored
LIBCD.lib(mbctype.obj) : warning LNK4006: __getmbcp already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
LIBCD.lib(winxfltr.obj) : warning LNK4006: __XcptFilter already defined in msvcrtd.lib(MSVCRTD.dll); second definition ignored
msvcrtd.lib(MSVCRTD.dll) : warning LNK4006: __setmbcp already defined in LIBCD.lib(mbctype.obj); second definition ignored
   Creating library Debug/APathFindTest.lib and object Debug/APathFindTest.exp
LINK : warning LNK4098: defaultlib "msvcrtd.lib" conflicts with use of other libs; use /NODEFAULTLIB:library
LINK : warning LNK4098: defaultlib "LIBCD" conflicts with use of other libs; use /NODEFAULTLIB:library
Debug/APathFindTest.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.

原因与修改办法:

默认的"libcmtd.lib"和其他的一些libs有冲突,可以用/NODEFAULTLIB:library设置屏蔽掉默认的 libcmtd.lib。

在Project中打开Project Setting设置对话框,选择Link选中Category旁边下拉框的Input项。

在Ignore Libraries下面输入libcmtd.lib,将此屏蔽。

回过头来,原来我的程序是USE mfc  in a share dll, 而libcmtd.lib是静态 C runtime库,所以应该屏蔽掉libcmtd.lib,以免造成冲突。

你可能感兴趣的:(c,object,mfc,input,dll,library)