CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: mixing Debug and Realese builds of a library not working?

Hybrid View

  1. #1
    Join Date
    Mar 2009
    Posts
    166

    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.

  2. #2
    Join Date
    Jul 2002
    Posts
    2,543

    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

  3. #3
    Join Date
    Jun 2002
    Location
    Letchworth, UK
    Posts
    1,019

    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

  4. #4
    Join Date
    May 2002
    Location
    Lindenhurst, NY
    Posts
    867

    Re: mixing Debug and Realese builds of a library not working?

    Quote Originally Posted by ekhule View Post
    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width




On-Demand Webinars (sponsored)