Link Error LNK2038: RuntimeLibrary And _ITERATOR_DEBUG_LEVEL Mismatch
来源:互联网 发布:微信群控软件下载 编辑:程序博客网 时间:2024/05/16 14:03
转载自: http://cpluspluslearning-petert.blogspot.jp/2016/02/link-error-lnk2038-runtimelibrary-and.html
1. Problem Description
The problem happens when I was trying to compile C++ code base in Windows with VC11 compiler (Visual Studio Premier 2012). Linker Error LNK2038 pops up under debug version when linking against the release version of the third party libraries. (Bear in mind that the release version is compiled fine and running all the tests passed.)
Read through what LNK2038 is from Microsoft, Linker Tools Error LNK2038. There are four types mismatching that are checked, _MSC_VER, _ITERATOR_DEBUG_LEVEL, RuntimeLibrary and _PPLTASKS_WITH_WINRT. Generally I believe that this is a good idea to enforce all the software are compiled with the same setting. But this should make an exception when involving the third party software that are not guaranteed to be compiled with the same settings.
Indeed as some of threads in Stackoverfolow, for example _ITERATOR_DEBUG_LEVEL Mismatch and RuntimeLibrary Mismatch, indicate that the proper fix is to setting the _ITERATOR_DEBUG_LEVEL and RuntimeLibrary as the same value across all the software including the third party libraries and DLL. And above two threads in Stackoverflow have also pointed out how to set them under Visual Stuido 2012.
2. Quick Fix
In case that the debug version of third party libraries or DLL are not available (in most case NOT, who will release debug version and debug version usually only useful for internal debugging or fixing technical issues which may be reported by customers). And as well in case that the C++ code base is compiled cross-platform via an invoking script, like make build debug, make build release, the following is helpful for you to cross this linking error hurdle. (For those compiling C++ code via Visual Studio IDE then set these variables via project configuration for C++ section.)
Using the following compiler options,
* -D_ALLOW_MSC_VER_MISMATCH
This flag allows _MSV_VER mismatch
* -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
This flag allows _ITERATOR_DEBUG_LEVEL mismatch
* -D_ALLOW_RUNTIME_LIBRARY_MISMATCH
This flag allows RuntimeLibrary mismatch
When -D appears in the VC compiler, it is to define the following as a MACRO before the actual compiling process starts (in this case before preprocessing starts). Now add these options into your compiler, then your software should fly.
These three MACROs are simply to turn off the mismatch detection for each variable respectively. Check the file, yvas.h, under your Visual Studio installation for more details.
The problem happens when I was trying to compile C++ code base in Windows with VC11 compiler (Visual Studio Premier 2012). Linker Error LNK2038 pops up under debug version when linking against the release version of the third party libraries. (Bear in mind that the release version is compiled fine and running all the tests passed.)
Read through what LNK2038 is from Microsoft, Linker Tools Error LNK2038. There are four types mismatching that are checked, _MSC_VER, _ITERATOR_DEBUG_LEVEL, RuntimeLibrary and _PPLTASKS_WITH_WINRT. Generally I believe that this is a good idea to enforce all the software are compiled with the same setting. But this should make an exception when involving the third party software that are not guaranteed to be compiled with the same settings.
Indeed as some of threads in Stackoverfolow, for example _ITERATOR_DEBUG_LEVEL Mismatch and RuntimeLibrary Mismatch, indicate that the proper fix is to setting the _ITERATOR_DEBUG_LEVEL and RuntimeLibrary as the same value across all the software including the third party libraries and DLL. And above two threads in Stackoverflow have also pointed out how to set them under Visual Stuido 2012.
2. Quick Fix
In case that the debug version of third party libraries or DLL are not available (in most case NOT, who will release debug version and debug version usually only useful for internal debugging or fixing technical issues which may be reported by customers). And as well in case that the C++ code base is compiled cross-platform via an invoking script, like make build debug, make build release, the following is helpful for you to cross this linking error hurdle. (For those compiling C++ code via Visual Studio IDE then set these variables via project configuration for C++ section.)
Using the following compiler options,
* -D_ALLOW_MSC_VER_MISMATCH
This flag allows _MSV_VER mismatch
* -D_ALLOW_ITERATOR_DEBUG_LEVEL_MISMATCH
This flag allows _ITERATOR_DEBUG_LEVEL mismatch
* -D_ALLOW_RUNTIME_LIBRARY_MISMATCH
This flag allows RuntimeLibrary mismatch
When -D appears in the VC compiler, it is to define the following as a MACRO before the actual compiling process starts (in this case before preprocessing starts). Now add these options into your compiler, then your software should fly.
These three MACROs are simply to turn off the mismatch detection for each variable respectively. Check the file, yvas.h, under your Visual Studio installation for more details.
阅读全文
0 0
- Link Error LNK2038: RuntimeLibrary And _ITERATOR_DEBUG_LEVEL Mismatch
- error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL'
- VS2015 Error LNK2038 mismatch detected for 'RuntimeLibrary'解决
- error LNK2038 RuntimeLibrary 不匹配
- error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value '
- error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MTd_StaticDebug' doesn't match value '
- 【error】LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value
- 【error】LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value
- error LNK2038: mismatch detected for \'_ITERATOR_DEBUG_LEVEL\': value \'0\' doesn\'t match value \'2\' in *.obj
- 【error】LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
- 【error】LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value
- 【error】LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value
- error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '
- error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0'
- error LNK2038 RuntimeLibrary 不匹配的解决
- error LNK2038 RuntimeLibrary 不匹配的解决
- error LNK2038: '_ITERATOR_DEBUG_LEVEL'不匹配的解决办法
- vs2012 error LNK2038 RuntimeLibrary 不匹配的解决
- R的安装与RStudio的安装
- react-navigation示例
- python 从文件读写,mysql批量插入数据
- c++函数返回引用的问题
- dedecms 分页标题
- Link Error LNK2038: RuntimeLibrary And _ITERATOR_DEBUG_LEVEL Mismatch
- c# Json数据转换成DataSet
- elipse 里 File Seach 搜不出来任务结果,显示0 条 matched
- React 如何优雅地写单页面应用?
- Leetcode Insert Interval
- android播放有旋转角度的视频
- Notification通知栏的基本使用
- navicat for mysql 10.0.11简体中文破解版 绿色版
- JDK动态proxy原理解析