Search code examples
c++visual-studiocompiler-errorslinker-errorsamqp

_ITERATOR_DEBUG_LEVEL mismatch for one file in project


I am trying to compile my C++ project in Visual Studio Community 2022 (v143) with amqpcpp library but with no success.

I have built amqpcpp library file using instructions on their github page and imported amqpcpp.lib to Visual Studio linker and included headers for the compiler. Visual Studio recognized the new library and Intellisense is working properly with it.

When it comes to compiling I get multiple errors stating the same description

Error LNK2038 mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in Assembly.obj IntegratorWorkflow C:\Users\user\source\repos\IntegratorWorkflow\amqpcpp.lib(field.obj)

For multiple files of amqpcpp.lib I get the same error, the only difference is the file name at the end

My project was compiling properly with the Debug option from the start but only after including amqpcpp.lib I get an error.

I tried to compile this library using "COMPILE_FLAGS_DEBUG "/D_ITERATOR_DEBUG_LEVEL=2" option in CMakeList.txt but still i got the same error.

I also checked all files in my project if any are set for Release mode but got nothing.

Maybe someone could help me resolve this issue. I'm glad for any help.


Solution

  • Okay I figured it out. My Visual Studio Project has had declared _ITERATOR_DEBUG_LEVEL=0 in Preprocessor Definitions for some reason. Removing this fixed the issue