Errors compiling and linking Release version (first try) in Visual Studio 2019

I have a JUCE Project that includes a JUCE static library. Everything compiles and links fine in the Debug version. I am trying the Release version for the first time and encountering a zillion errors.

First of all, there is this group of errors about ‘_ITERATOR_DEBUG_LEVEL’: value ‘2’ doesn’t match value ‘0’.
I googled this and it seems to be a preprocessor directive, but I do not see it entered anywhere in Visual Studio properties…or Projucer.

Second, there is a huge group of errors about “already defined in include_juce_core.obj” - I don’t know where to begin to figure out what the problem is here. Thanks for any suggestions.

Examples:

1>PROJ-Core.lib(M16_RT__.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in ProjectManager.obj
1>PROJ-Core.lib(M06_Init.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in ProjectManager.obj
1>PROJ-Core.lib(M06_Init.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in ProjectManager.obj
1>PROJ-Core.lib(M27_DBg2.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in ProjectManager.obj
1>PROJ-Core.lib(M27_DBg2.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in ProjectManager.obj
1>PROJ-Core.lib(M08_DBug.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in ProjectManager.obj
1>PROJ-Core.lib(M08_DBug.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in ProjectManager.obj
1>PROJ-Core.lib(M04_Calc.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in ProjectManager.obj
1>PROJ-Core.lib(M04_Calc.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in ProjectManager.obj
1>PROJ-Core.lib(K_Lookup.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in ProjectManager.obj
1>PROJ-Core.lib(K_Lookup.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in ProjectManager.obj

1>PROJ-Core.lib(include_juce_core.obj) : error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '2' doesn't match value '0' in ProjectManager.obj
1>PROJ-Core.lib(include_juce_core.obj) : error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MDd_DynamicDebug' doesn't match value 'MD_DynamicRelease' in ProjectManager.obj
1>PROJ-Core.lib(include_juce_core.obj) : error LNK2005: "private: static class juce::Logger * juce::Logger::currentLogger" (?currentLogger@Logger@juce@@0PEAV12@EA) already defined in include_juce_core.obj
1>PROJ-Core.lib(include_juce_core.obj) : error LNK2005: "char const * const * const juce::zlibNamespace::z_errmsg" (?z_errmsg@zlibNamespace@juce@@3QBQEBDB) already defined in include_juce_core.obj
1>PROJ-Core.lib(include_juce_core.obj) : error LNK2005: "class juce::NewLine juce::newLine" (?newLine@juce@@3VNewLine@1@A) already defined in include_juce_core.obj
1>PROJ-Core.lib(include_juce_core.obj) : error LNK2005: "struct HWND__ * juce::juce_messageWindowHandle" (?juce_messageWindowHandle@juce@@3PEAUHWND__@@EA) already defined in include_juce_core.obj
1>PROJ-Core.lib(include_juce_core.obj) : error LNK2005: "bool __cdecl juce::juce_isRunningUnderDebugger(void)" (?juce_isRunningUnderDebugger@juce@@YA_NXZ) already defined in include_juce_core.obj
1>PROJ-Core.lib(include_juce_core.obj) : error LNK2005: "int __cdecl juce::findHighestSetBit(unsigned int)" (?findHighestSetBit@juce@@YAHI@Z) already defined in include_juce_core.obj

How was that JUCE static library built? If it was only built in Debug configuration, then you can only use it in a JUCE project in Debug configuration. You can’t mix Debug and Release.

The library also has a debug and release projects defined in the Projucer Exporter. And the library’s VS Project is included in the main app’s Visual Studio Solution as a subproject, so that it compiles first, so I assume that when I choose “Release” from the Solution Configuration at the top of VS that it is going to build the library as Release, and then the app as Release.

I’m not sure VS subproject support was ever added to the Projucer – there are a few threads on the topic but a quick look didn’t turn up anything definitive. You may just have to build JUCE separately, then add the debug/release paths to the respective configurations in your project’s VS exporter.

Thanks - it wasn’t. However, I simply add the subproject manually in VS after exporting from the Projucer each time. It’s annoying, but it works.

However, I’m now building the library separately and the app, and I’m seeing that there’s some confusion over where the path to the lib is for debug vs. release, so will look into that further…

Thanks for the replies, you got me looking in the right direction. Turns out I had an include path to the Debug version of the library, in the main Project Release version .

1 Like