简体   繁体   中英

error LNK2038: mismatch detected

There are lots of questions on this issue, but I'm struggling to get the answers to work for me. I have the specific error message:

gurobi_c++mdd2010.lib(Env.2010.omdd) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in DataHelper.obj

in visual studio 2010, in a release x64 build. The Gurobi library is 3rd party software, and DataHelper is my class.

Setting _ITERATOR_DEBUG_LEVEL=0 in DataHelper doesn't fix the problem, and I do not appear to be linking against 'debug' .lib or .dll in my files. _SECURE_SCL is not set in my files.

I tried to set _ITERATOR_DEBUG_LEVEL=2 in the preprocessor definitions, and I get:

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\yvals.h(113): fatal error C1189: #error :  _ITERATOR_DEBUG_LEVEL > 1 is not supported in release mode.

Can anyone confirm the problem is on my side, or on the 3rd party side, and suggest any workarounds if it is the 3rd party library?

Thanks Melanie

If _ITERATOR_DEBUG_LEVEL > 1 is not supported in release mode and the error message implies that _ITERATOR_DEBUG_LEVEL == 2 in gurobi_c++mdd2010.lib , then either that lib or one of its dependencies must be a Debug build.

It's probably worth investigating this angle, so check here and make sure you are linking the correct lib, based on your project settings.

I had a similar problem with a solution that I migrated from VS2005 to VS2010. It had two projects, a static library and an executable. Apparently there are multiple ways to instruct VS2010 to link a static library into an executable. One of those methods is via "Framework and References" on Property Pages for the executable's project. Click on "Add New Reference..." and add the static library here and it will give the linker error described in the OP's question because it doesn't care about debug vs release builds - it will grab the same static library for both, which results in an error for one of the two. My solution was to remove the reference (click "Remove Reference"), and then use the "Linker > Input > Additional Dependencies" and "Linker > General > Additional Library Directories".

You need to link gurobi_c++md2010.lib instead of gurobi_c++mdd2010.lib.

The second d in mdd stands for debug.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM