Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
423 views
in Technique[技术] by (71.8m points)

c++ - _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.

This is left.

Error   3   error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in client.obj   C:UsersJohan-barDocumentsVisual Studio 2010Projectsclientclientjrtplib.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.

I am aiming to compile a Release executable because I want to test on different computers.

1) Which one is not in Release mode, JRTPLIB or client(mine, the one which is trying to compile)?

2) How does one change the ITERATOR_DEBUG_LEVEL? Both are using Runtime Library /MT and preprocessor definitions WIN32, _MT, along with the defaults I guess.

Cheers

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Compile everything you use with -D_ITERATOR_DEBUG_LEVEL=0 option. 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.

In older visual studios there was _SECURE_SCL and i am not sure if some of code may still use it. Put somewhere (say into stdafx.h) a static check that these match.

#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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...