-
December 8th, 2009, 08:14 AM
#1
mixing Debug and Realese builds of a library not working?
Hello,
I have a library and a simple application that uses the library. It works with these combinations:
library (debug) - application (debug)
library (release) - application (release)
but it does not work if I mix release and debug versions like this:
library (debug) - application (release)
library (release) - application (debug)
It seems to crash in wierd places.. any idea why this might be happening? Am I required to use debug version of a library with a debug application utilizing that library and vice versa?
By the way, my libraries are all statics .lib files.
Regards,
E. Khule
Last edited by ekhule; December 8th, 2009 at 08:23 AM.
-
December 8th, 2009, 08:28 AM
#2
Re: mixing Debug and Realese builds of a library not working?
This can happen when classes exported from a library have configuration-dependent members. For example:
#ifdef _DEBUG
int m_nData;
#endif
-
December 8th, 2009, 08:51 AM
#3
Re: mixing Debug and Realese builds of a library not working?
It really depends on the code generation options. I'm assuming you're using visual studio. If you set both debug and release to use the same code generation options and remove any ignore statements from the linker, then it should work.
The problem is that the debug version is linked against one C runtime library while the release version is linked against another. If they're both linked against the same runtime library, then things should work better.
Succinct is verbose for terse
-
December 8th, 2009, 09:54 AM
#4
Re: mixing Debug and Realese builds of a library not working?
Originally Posted by ekhule
Am I required to use debug version of a library with a debug application utilizing that library and vice versa?
By the way, my libraries are all statics .lib files.
I'm not sure if its a requirement, but I do it anyway. To make it easier I change the output file of the debug version of the static lib to mylibd (I add 'd' to the end of the .lib name). Then in the application that uses the static lib, I use mylibd.lib for the debug config & mylib.lib for the release config.
Last edited by Martin O; December 8th, 2009 at 09:58 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|