1. 程式人生 > >error LNK2005: __cinit already defined in libcmt.lib(crt0dat.obj)

error LNK2005: __cinit already defined in libcmt.lib(crt0dat.obj)

用靜態庫去編譯,若出現下面錯誤:
LIBC.lib(crt0dat.obj) : error LNK2005: __cinit already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: _exit already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exit already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005:

__cexit already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __c_exit already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Exit_Done already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __C_Termination_Done already defined in
libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __exitflag already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wpgmptr already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __pgmptr already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005:
___winitenv already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __wenviron already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___initenv already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __environ already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___wargv already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argv already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: ___argc already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winminor already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winmajor already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __winver already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __osver already defined in libcmt.lib(crt0dat.obj)
LIBC.lib(crt0dat.obj) : error LNK2005: __umaskval already defined in libcmt.lib(crt0dat.obj)
LINK : warning LNK4098: defaultlib "LIBC" conflicts with use of other libs; use /NODEFAULTLIB:library
../bin//????.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
這是庫和可執行程式使用了不同的庫所引起的衝突。在主程式中的project-settings的link頁,下拉框選input項,
在Ignore Librarys中增加:
如果是release版的話:
libc.lib,msvcrt.lib,mfc42.lib
若是debug版,則應為
libcd.lib,msvcrtd.lib,mfc42d.lib。