VS2010运行结果报错error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”

VS2010运行结果报错error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“0”不匹配值“2”。

1、错误原因:Debug使用了Release的库文件。
    若你连接库里两种库文件都添加着,但是却把release库文件放在了debug前面,也是会出错的。因为程序默认按顺序使用库文件。
    若报错为error LNK2038: 检测到“_ITERATOR_DEBUG_LEVEL”的不匹配项: 值“2”不匹配值“0”。
    则可能是在release下使用了Debug的库文件。一般库文件中文件名后面加d的是debug库文件,没有加d的是release库文件。

2、解决方法:
    通过几天的查询,结合网友们的智慧,发现只需在预处理定义中设定“_ITERATOR_DEBUG_LEVEL”的值,使其符合要调试用的程序。
    在项目-〉属性-〉配置属性-〉C/C++ -〉预处理器-〉预处理定义  添加“_ITERATOR_DEBUG_LEVEL=0”即可。

3、英文补充说明:
    In VS2010 iterator debug level defaults to 2 in debug and is disabled in release. One of the dlls you are using probably has iterator debugging turned off in debug either because it was built in an older version of visual studio or they explicitly added the defines to the project.

    Search for _ITERATOR_DEBUG_LEVEL and _SECURE_SCL remove them or set them appropriately in all projects and sources and rebuild everything.

_ITERATOR_DEBUG_LEVEL = 0 // disabled (for release builds)
_ITERATOR_DEBUG_LEVEL = 1 // enabled (if _SECURE_SCL is defined)
_ITERATOR_DEBUG_LEVEL = 2 // enabled (for debug builds)

  • 2
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值