c++ - Visual Studio 中的 _ITERATOR_DEBUG_LEVEL 错误

标签 c++ visual-studio winapi compiler-construction release

我正在尝试在 Windows 7 上的 Visual Studio 2010 中编译 JRTPLIB。这是一场真正的噩梦……但我至少缩小了问题范围。

这是剩下的。

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

我用谷歌搜索了很多,原因似乎是一个在 Debug模式下编译,而另一个在 Release模式下编译。

我的目标是编译一个 Release 可执行文件,因为我想在不同的计算机上进行测试。

1) 哪个不在 Release模式,JRTPLIB 或客户端(我的,正在尝试编译的那个)?

2) 如何更改 ITERATOR_DEBUG_LEVEL?两者都使用运行时库/MT 和预处理器定义 WIN32、_MT,以及我猜的默认值。

干杯

最佳答案

使用 -D_ITERATOR_DEBUG_LEVEL=0 选项编译您使用的所有内容。在 VS 2010 Release 模式下默认是这样,但有些东西仍然是用其他选项构建的,因此不兼容二进制。

在较旧的 Visual Studio 中,有 _SECURE_SCL,我不确定某些代码是否仍然可以使用它。在某处(比如在 stdafx.h 中)放置这些匹配的静态检查。

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

如果您想查看 _ITERATOR_DEBUG_LEVEL 有什么值,那么您可以在代码中使用一些#pragma 消息来告诉您。

关于c++ - Visual Studio 中的 _ITERATOR_DEBUG_LEVEL 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4738987/

相关文章:

visual-studio - Azure功能单独调试和部署

c++ - 运行时进程名称更改 (C++)

sockets - 将对 TCP 服务的访问限制为当前用户 session

c++ - VS2010 : "Cannot find the resource compiler DLL. Please make sure the path is correct."

c# - Visual Studio 2013 : create installer

visual-studio - 有什么快速方法可以将 Visual Studio Ultimate/Enterprise 版降级为 Professional 版吗?

c++ - 在另一个进程正在写入文件时读取文件

c++ - 在 C++11 中,为什么不能在 std::move 之后使用 moved 变量?

c++ - 令人困惑的 switch 语句行为

c++ - 矩阵运算的模数误差