I am using MS Studio 2015 and incorporating the MKL (2017) library. Everything compile fine when code generation is in release mode:
Configuration Properties>C/C++>Code Generation>Runtime Library = /MT
However, it seems impossible to correctly build and link a debug version of the application. Where the runtime is set to debug
Configuration Properties>C/C++>Code Generation>Runtime Library = /MTd
This results in link errors related to debug symbols:
error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in ...
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in ...
Other libraries (such as the TBB library) supply _debug versions of the library just for this reason. For example, the TBB has these libraries:tbb.lib and tbb_debug.lib.
I don't find and _debug versions of the MKL libraries. Are they available or is there some other way to properly link an application in debug mode with the MKL.
I used MKL2017 & ICC 2017 integrated in the VS2015. But I could not reproduce your problem even I changed runtime lib to MTd. I just wonder how you link and compile your MKL lib, did you also used other Intel library except MKL? Did you link libs manually or automatically?
For your problem, I searched that some one has similar problem but not using Intel MKL. It probably problem of VS. Normally, 2 is for debug & 0 for release. But for some version of VS, The default value of _ITERATOR_DEBUG_LEVEL might be different, depending on configuration. Did you also change the configuration to "Debug" when you set to use multi-thread debug runtime library? There's a method that you could set _ITERATOR_DEBUG_LEVEL=2 in Configuration Properties / C,C++ / Preprocessor / Preprocessor Definitions. Please have a try with it.
Thanks for the feedback...
Based on what you said I created a new basically empty solution and found that you are quite right. The MKL compile and links with the application in both release and debug modes.
So I went back to the main application and I removed libraries one at a time to find what was conflicting with MKL in the debug link. It turns out in my case it was the MS Parallel Patterns Library. Since I have access to TBB as I switch to this library and the link errors were resolved.