简体   繁体   English

visual studio中的_ITERATOR_DEBUG_LEVEL错误

[英]_ITERATOR_DEBUG_LEVEL error in visual studio

I am trying to compile JRTPLIB in Visual Studio 2010 on windows 7. It's been a true nightmare... but I'm atleast narrowing down the problems. 我试图在Windows 7上的Visual Studio 2010中编译JRTPLIB。这是一场真正的噩梦......但我至少要缩小问题范围。

This is left. 这是留下的。

Error   3   error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in client.obj   C:\Users\Johan-bar\Documents\Visual Studio 2010\Projects\client\client\jrtplib.lib(rtpsession.obj)  client

I googled a ton and the cause seems to be one is compiled in debug mode while the other is compiled in release mode. 我googled一吨,原因似乎是一个是在调试模式下编译而另一个是在发布模式下编译。

I am aiming to compile a Release executable because I want to test on different computers. 我的目标是编译一个Release可执行文件,因为我想在不同的计算机上进行测试。

1) Which one is not in Release mode, JRTPLIB or client(mine, the one which is trying to compile)? 1)哪一个不处于发布模式,JRTPLIB或客户端(我的,正在尝试编译的那个)?

2) How does one change the ITERATOR_DEBUG_LEVEL? 2)如何更改ITERATOR_DEBUG_LEVEL? Both are using Runtime Library /MT and preprocessor definitions WIN32, _MT, along with the defaults I guess. 两者都使用运行时库/ MT和预处理器定义WIN32,_MT,以及我猜的默认值。

Cheers 干杯

Compile everything you use with -D_ITERATOR_DEBUG_LEVEL=0 option. 使用-D_ITERATOR_DEBUG_LEVEL = 0选项编译您使用的所有内容。 It is so by default in VS 2010 Release mode, but some things are still built with other options and so are not binary compatible. 默认情况下在VS 2010 Release模式下是这样,但有些东西仍然使用其他选项构建,因此不是二进制兼容的。

In older visual studios there was _SECURE_SCL and i am not sure if some of code may still use it. 在较旧的视觉工作室中有_SECURE_SCL,我不确定某些代码是否仍然可以使用它。 Put somewhere (say into stdafx.h) a static check that these match. 把某些地方(比如stdafx.h)放到这些匹配的静态检查中。

#if _ITERATOR_DEBUG_LEVEL == 0 && _SECURE_SCL != 0 
#error _SECURE_SCL != 0 when _ITERATOR_DEBUG_LEVEL == 0 
#endif 

If you want to see what value _ITERATOR_DEBUG_LEVEL has then you can use some #pragma message in code to tell you. 如果你想查看_ITERATOR_DEBUG_LEVEL有什么值,那么你可以在代码中使用一些#pragma消息来告诉你。

The solution: 解决方案:

Project Pages >> Configuration Properties >> C,C++ >> Preprocessor >> Preprocessor Definitions

Add _ITERATOR_DEBUG_LEVEL=0 in there worked. 在工作中添加_ITERATOR_DEBUG_LEVEL=0 See also: How to set _ITERATOR_DEBUG_LEVEL in VS2010? 另请参见: 如何在VS2010中设置_ITERATOR_DEBUG_LEVEL?

I found another way to generate these errors. 我发现了另一种产生这些错误的方法。

I was using the Visual Studio 2010 batch build to build all possible combinations of platform and configuration and I was getting these errors. 我使用Visual Studio 2010批处理构建来构建平台和配置的所有可能组合,我遇到了这些错误。 Looking at the output revealed that batch build was not honoring the project dependencies -- hence linking a stale library from the Release build witha freshly compiled Debug obj file. 查看输出显示批处理构建不符合项目依赖性 - 因此使用新编译的Debug obj文件链接来自Release构建的陈旧库。

Several lines later in the build output it built the Debug version of the library. 在构建输出中的几行之后,它构建了库的Debug版本。

Doing the "batch build" by hand (ie manually selecting the various combinations of platform and configuration) produced a clean build. 手动执行“批量构建”(即手动选择平台和配置的各种组合)产生了干净的构建。

Moral: Do not use Visual Studio 2010 batch build. 道德:不要使用Visual Studio 2010批量构建。 I don't know if they've fixed this in later versions of VS. 我不知道他们是否已在VS的更高版本中修复此问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 visual studio中的_ITERATOR_DEBUG_LEVEL错误,接受的解决方案无效 - _ITERATOR_DEBUG_LEVEL error in visual studio, accepted solution not working 如何将 _ITERATOR_DEBUG_LEVEL 添加到 CMake? - How to add _ITERATOR_DEBUG_LEVEL to CMake? Cuda(NVCC)编译器的_ITERATOR_DEBUG_LEVEL? - _ITERATOR_DEBUG_LEVEL of Cuda (NVCC) compiler? _ITERATOR_DEBUG_LEVEL = 1是什么意思? - What does _ITERATOR_DEBUG_LEVEL = 1 mean? 使用C ++库时出现LINK错误(ITERATOR_DEBUG_LEVEL) - LINK Error while using C++ library (ITERATOR_DEBUG_LEVEL) 我应该将什么设置为 _ITERATOR_DEBUG_LEVEL - What should I set to _ITERATOR_DEBUG_LEVEL _iterator_debug_level 值“0”与值“2”不匹配 - _iterator_debug_level value '0' doesn't match value '2' 当用_ITERATOR_DEBUG_LEVEL = 0销毁向量时,为什么Visual C ++ 2010仍调用Orphan_all? - Why is Visual C++ 2010 still calling Orphan_all when a vector is destroyed with _ITERATOR_DEBUG_LEVEL=0? 错误 LNK2038:检测到“_ITERATOR_DEBUG_LEVEL”不匹配:值“0”与 main.obj 中的值“2”不匹配 - error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj 错误 LNK2038:检测到“_ITERATOR_DEBUG_LEVEL”不匹配:值“2”与 XX.obj 中的值“0”不匹配 - Error LNK2038 : mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in XX.obj
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM