error LNK2005: _CrtSetCheckCount already defined in MSVCRTD.lib

编译错误:

Error1error LNK2005: _CrtSetCheckCount already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(dbgheap.obj)

Error2error LNK2005: _calloc_dbg already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(dbgheap.obj)

Error3error LNK2005: _free_dbg already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(dbgheap.obj)

Error4error LNK2005: _malloc_dbg already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(dbgheap.obj)

Error5error LNK2005: _amsg_exit already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(crt0dat.obj)

Error6error LNK2005: _initterm_e already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(crt0dat.obj)

Error7error LNK2005: __CppXcptFilter already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(winxfltr.obj)

Error8error LNK2005: __crtCaptureCurrentContext already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(winapisupp.obj)

Error9error LNK2005: __crtCapturePreviousContext already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(winapisupp.obj)

Error10error LNK2005: __crtTerminateProcess already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(winapisupp.obj)

Error11error LNK2005: __crtUnhandledException already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(winapisupp.obj)

Error12error LNK2005: _lock already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(mlock.obj)

Error13error LNK2005: _unlock already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(mlock.obj)

Error14error LNK2005: __crt_debugger_hook already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(dbghook.obj)

Error15error LNK2005: "void __cdecl terminate(void)" (?terminate@@YAXXZ) already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(hooks.obj)

Error16error LNK2005: __xi_a already defined in MSVCRTD.lib(cinitexe.obj)\libcmtd.lib(crt0init.obj)

Error17error LNK2005: __xi_z already defined in MSVCRTD.lib(cinitexe.obj)\libcmtd.lib(crt0init.obj)

Error18error LNK2005: __xc_a already defined in MSVCRTD.lib(cinitexe.obj)\libcmtd.lib(crt0init.obj)

Error19error LNK2005: __xc_z already defined in MSVCRTD.lib(cinitexe.obj)\libcmtd.lib(crt0init.obj)

Error20error LNK2005: __iob_func already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(_file.obj)

Error21error LNK2005: _CrtDbgReportW already defined in MSVCRTD.lib(MSVCR110D.dll)\libcmtd.lib(dbgrptw.obj)

 

原因:静态库或动态库编译时的设置的Runtime Library和当前工程不一样

 

解决办法:工程Property -> C/C++ -> Code Generation -> Runtime Library设置为统一的,例如Debug模式下,统一为MTd,Release模式下统一为MT

你可能感兴趣的:(error)