I tried to link a library (let's call it LibB
) to a program (TheProgram
) that already linked another library (LibA
).
The debug configuration builds fine, but in release mode I get this error:
error LNK2038: mismatch detected for 'RuntimeLibrary': value 'MT_StaticRelease' doesn't match value 'MTd_StaticDebug' in TheProgram.obj
I thought that's easy to fix, because I only need to make sure that each of the linked objects are built with /MT. I did, and they all are. I also checked if there are any per-file settings that have the runtime flag differently in this configuration - there aren't. Also checked the final command line in the build - it's /MT everywhere.
Even more interestingly, if I link the debug version of LibB
(while building the Release configuration), this error disappears, but I get other errors.
What could cause the mismatch despite the matching flags everywhere?