错误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

查看:2283
本文介绍了错误LNK2038:检测到“_ITERATOR_DEBUG_LEVEL”的不匹配:值“0”与main.obj中的值“2”不匹配的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经读了很多解决我的问题,但没有帮助。我试过清洁,重建。重新安装视觉2010年,从专业到终极。但仍然我不知道为什么我有这个错误。
我的项目看起来像这样:
1 Exe测试我的静态库的解决方案。
1 Dll解决方案静态库。
转换为dll的代码使用来自1 lib的函数,名为ClassificationFramework。我提供这个lib作为头和cpp所以基本上源代码。在Exe解决方案中,我链接我生成的库+一些其他库运行它+ ClassificationFramework.dll。一切工作正常,当我使用发布,但当我改变到调试(因为我想调试一些东西,我厌ired了跳过调试器在发布模式)我得到这个:

I have read a lot of solutions to my problem but none helped. I tried clean, rebuild. Reinstalled visual 2010 and change from professional to ultimate. But still I dont know why I have this error. My project look like this: 1 Exe Solution to test my static library. 1 Dll Solution static library. Code which is converted to dll is using function from 1 lib called ClassificationFramework. I provided this lib as headers and cpp so basically source code. In Exe solution I linked my generated library + some other libs to run it + ClassificationFramework.dll. Everything works fine when I use Release but when I change to Debug (because I want to debug some stuff, I am tired of skipping debugger in release mode) I get this:

    2>Link:
    2>  ClassificationFramework.lib(SampleClass.obj) : MSIL .netmodule or module compiled with /GL found; restarting link with /LTCG; add /LTCG to the link command line to improve linker performance
    2>ClassificationFramework.lib(SampleClass.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
    2>ClassificationFramework.lib(SampleNamesSet.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
    2>ClassificationFramework.lib(SampleSet.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
    2>ClassificationFramework.lib(DirectoryReader.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
    2>LINK : warning LNK4098: defaultlib 'MSVCRT' conflicts with use of other libs; use /NODEFAULTLIB:library
    2>C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Transformer\Debug\Tester.exe : fatal error LNK1319: 4 mismatches detected

当我在版本中构建时,我也得到了这些警告:

When I build in Release I also got these warnings:

    1>Link:
    1>  Generating code
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\utility(101): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because ptimizations are disabled in function
    1>c:\users\kasia\documents\visual studio 2010\projects\classificationframework\classificationframework\directoryreader.cpp(30): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
    1>c:\program files (x86)\microsoft visual studio 10.0\vc\include\xstring(1589): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
    1>c:\users\kasia\documents\visual studio 2010\projects\classificationframework\classificationframework\samplenamesset.cpp(226): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
    1>c:\users\kasia\documents\visual studio 2010\projects\classificationframework\classificationframework\directoryreader.cpp(60): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
    1>c:\users\kasia\documents\visual studio 2010\projects\classificationframework\classificationframework\samplenamesset.cpp(199): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
    1>c:\users\kasia\documents\visual studio 2010\projects\classificationframework\classificationframework\sampleset.cpp(27): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
    1>c:\users\kasia\documents\visual studio 2010\projects\classificationframework\classificationframework\samplenamesset.cpp(59): warning C4748: /GS can not protect parameters and local variables from local buffer overrun because optimizations are disabled in function
    1>  Finished generating code
    1>ClassificationFramework.lib(SampleSet.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'ClassificationFramework.lib(SampleSet.obj)' or at 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Transformer\Release\vc100.pdb'; linking object as if no debug info
    1>ClassificationFramework.lib(SampleNamesSet.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'ClassificationFramework.lib(SampleNamesSet.obj)' or at 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Transformer\Release\vc100.pdb'; linking object as if no debug info
    1>ClassificationFramework.lib(SampleClass.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'ClassificationFramework.lib(SampleClass.obj)' or at 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Transformer\Release\vc100.pdb'; linking object as if no debug info
    1>ClassificationFramework.lib(DirectoryReader.obj) : warning LNK4099: PDB 'vc100.pdb' was not found with 'ClassificationFramework.lib(DirectoryReader.obj)' or at 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Transformer\Release\vc100.pdb'; linking object as if no debug info
    1>  Tester.vcxproj -> C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Transformer\Release\Tester.exe






我发现Debugger因为错误的pdb文件路径而跳过。


I found that Debugger skips because of wrong path to pdb files.

'Tester.exe': Loaded 'C:\Documents and Settings\Administrator\My Documents\Visual Studio 2010\Projects\Work\Release\Tester.exe', Symbols loaded.
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Tester.exe': Unloaded 'C:\WINDOWS\SysWOW64\kernel32.dll'
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\ntdll.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\kernel32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\OpenCV2.2\bin\opencv_core220.dll', Binary was not built with debug information.
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\msvcp100.dll', Symbols loaded.
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\msvcr100.dll', Symbols loaded.
'Tester.exe': Loaded 'C:\OpenCV2.2\bin\opencv_highgui220.dll', Binary was not built with debug information.
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\user32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\gdi32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\advapi32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\rpcrt4.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\secur32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\ole32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\msvcrt.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\WinSxS\x86_Microsoft.Windows.Common-Controls_6595b64144ccf1df_5.82.3790.4770_x-ww_A689AB02\comctl32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\avifil32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\winmm.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\msacm32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\msvfw32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\shell32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\shlwapi.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\avicap32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\version.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\OpenCV2.2\bin\opencv_imgproc220.dll', Binary was not built with debug information.
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\imm32.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\lpk.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\SysWOW64\usp10.dll', Cannot find or open the PDB file
'Tester.exe': Loaded 'C:\WINDOWS\WinSxS\wow64_Microsoft.Windows.Common-        Controls_6595b64144ccf1df_6.0.3790.4770_x-ww_8D2E3180\comctl32.dll', Cannot find or open the PDB file
The program '[4984] Tester.exe: Native' has exited with code 0 (0x0).

当我去调试 - > Windows的>模块我看到他无法找到那些pdb文件或东西。我怎么能说他的文件是在这里和这里?我试图运行MSvisual作为管理员,但太did not帮助。我用微软的服务器加载PDB文件,但也没有帮助。

When i go to Debug->Windows->Modules i see that he cannot find those pdb files or something. How i can say him that those files are here here and here? I tried to run MSvisual as administrator but that too didnt help. I used microsoft server to load pdb files but also didnt help.

推荐答案

在VS2010迭代器调试级别缺省为2,是禁用发布。一,你正在使用可能是DLL文件已经迭代器调试调试关闭,可能是因为它建于一个旧版本的Visual Studio或他们明确添加的定义了该项目。

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.

搜索 _ITERATOR_DEBUG_LEVEL _SECURE_SCL 删除或所有项目和资源适当地设置他们和重建一切。

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)

在短期你可能混放和调试DLL。不要在调试中链接发布dll,反之亦然!

In short you are probably mixing release and debug dlls. Don't linked release dlls in debug or vice versa!

这篇关于错误LNK2038:检测到“_ITERATOR_DEBUG_LEVEL”的不匹配:值“0”与main.obj中的值“2”不匹配的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆