Building with VS2010, I'm building a lib that causes many of these link errors:
error LNK2038: mismatch detected for '_ITERATOR_DEBUG_LEVEL': value '0' doesn't match value '2'
Resulting in a situation where I have to ship both a release and a debug version of my lib. I have no reason to ship a debug version of the lib, and it just bloats the binary distribution. But client code built in debug refuses to link against my release lib.
I've seen this question appear before, but they don't seem to be asking the right question. I understand what this error is, and why I'm getting it (well, sort of; I'm not sure precisely what emits the dependency. Do you?), but what I want to know is how to eliminate this dependency from occurring in my lib?
Similarly to libs which complain when conflicting CRT's are used, which can be prevented with /Zl (Omit default library name from object files), surely there's a way to prevent this dependency from being emitted into my libs too?
I simply want to produce a single optimised lib, which is capable of linking against either debug or release code. It's not important for client code to debug the lib. Almost no 3rd party libraries ship with distinct debug and release versions. How is it that vendors avoid this problem?
Does anyone know precisely what causes this link dependency, and how to I either disable it entirely, or factor it out of my code?