Mixing debug and release code is bad practice.
Different compiled versions can depend on different fundamental parts of the C++ runtime library, such as how memory is allocated, structures for things like iterators might be different, extra code could be generated to perform operations. In particular, the std containers and iterators are different and incompatible and do not let this work.
Sometimes one get the following error
A buffer overrun has occurred in Program_64.exe which has corrupted the program’s internal state. Press Break to debug the program or Continue to terminate the program.
For more details please see Help topic ‘How to debug Buffer Overrun Issues’.
So are we stuck?
But what if you have inherited the release library and do not have the source code. You are stuck for development and if the compiler is not letting you to use these libraries in your debug development code.
But we are not entirely stuck, here’s a workaround that worked for me.
// the offending libraries #include "quad.h" #include "uqtktools.h" #include "mytypedef.h" using namespace std;
The work around
#ifdef _DEBUG #define DEBUG_WAS_DEFINED #undef _DEBUG #endif // the offending libraries #include "quad.h" #include "uqtktools.h" #ifdef DEBUG_WAS_DEFINED #define _DEBUG #endif #include "mytypedef.h"