[ACCEPTED]-C++ Linking release built library with my debug build-c++

Accepted answer
Score: 13

If you want to distribute a release library 8 that others can use in either release or 7 debug mode, you need to do two things:

  • Build a DLL, so that you get your own copy of the C runtime library
  • Not share CRT resources, such as the heap, across the library boundary. The biggest thing for C code is that dynamically allocated memory has to be deallocated on the same side of the boundary. For C++ code, you can use the std namespace inside your DLL, but not pass those objects across the boundary.

That's 6 what the pre-built third-party libraries 5 have most likely done. You can do the same 4 thing with your library only if the external 3 interface doesn't share CRT objects. Or 2 you can build separate release and debug 1 versions as static libraries.

Score: 2

Looks like your debug binary and the library 14 you downloaded use incompatible iterator 13 debug modes. Iterator debugging is usually 12 controlled by macros. Depending on macro 11 values the sizes of interators and many 10 other objects can change. You are lucky 9 that your program emitted useful error message 8 instead of simply crushing.

Check the library 7 documentation and make sure that your project 6 uses the same iterator debug mode. You may 5 also try recompiling the library in release 4 mode. If that doesn't help, you would have 3 to recompile the library in debug mode, even 2 if you don't intend to debug the library 1 itself.

More Related questions