This question has been asked a few times already, but I observe that it always refers to Windows. Which makes sense, given that MSVC fails with the following error:
error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2' in main.obj
And it seems to me that on Linux, it does not fail at build time.
Answers mention different C++ runtime between the build types and not sharing CRT resources between such libraries. Still, it is not clear to me how different that behavior is in Linux/Windows and with shared/static libraries.
I would like to understand this better. Questions could be:
- Is it different between Windows and Linux?
- If it is also undefined behavior in Linux, how come it doesn't fail at build time?
- Is it different between static and shared libraries?
- Does my Linux package manager download debug versions of all the dev packages? Looking into
usr/lib/
, I can't seem to find both release and debug libraries there...