error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0'

問題描述:

    編譯時遇到錯誤:

    Error 1 error LNK2038: mismatch detected for'_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0'  

    Error 2 error LNK2038: mismatch detected for'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value'MD_DynamicRelease'

    Warning 3 warning LNK4098: defaultlib 'MSVCRTD'conflicts with use of other libs; use /NODEFAULTLIB:library

    Error 4 error LNK1319: 2 mismatches detected       

開發環境:

    Visual studio 2013 win10

問題分析:

    網上查找的關於error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value'2' doesn't match value '0'的錯誤原因主要是編譯項目與項目中所使用的鏈接庫debug/release版本不對應。

    但是最開始認爲兩個項目使用的均爲debug版本,不存在此問題。之後仔細檢查,發現僅僅生成鏈接庫文件(本文用的.lib庫)的項目編譯方式與使用庫文件的項目一致還不行,還要修改配置屬性。

解決方案:

    右鍵項目->屬性/properties->配置屬性/configuration properties->C/C++->代碼生成/codegeneration->運行庫/running library

    如下圖所示:

    其中下拉選項要與生成動態鏈接庫的項目保持一致。


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