CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2000
    Location
    Salmon Arm, BC, Canada
    Posts
    2

    Release vs Debug

    I am looking for a quick and easy method of telling if I have a release or debug version of a compiled binary (.exe .dll .ocx)
    Is there any way to tell or can something be built into the image?
    Something added automatically to a version block would be nice.


  2. #2
    Join Date
    Aug 2000
    Location
    New York, NY, USA
    Posts
    5,656

    Re: Release vs Debug

    I have a quick-and-dirty answer for you and a good one.
    1. If you use default "Release" and "Debug" configurations created by the App Wizard, you could open your file and see if the last three characters of it are "pdb" - then it's a Debug build.

    2. The good answer - there is NOT enough differences between the Debug and Release configurations to tell them apart. Lets analyze this:
    D: usually defines _DEBUG - there is no way you could determine if it was defined during preprocessor run.
    D: usually disables optimization - you can not tell it by looking at the binary.
    D: usually maintains symbols in the project database file (the "pdb" from #1), but unfortunately that could be true for a release build as well...

    I tried to create some differences in the VERSION_INFO table based on #ifdef, but the Resource Editor throws it out while saving that file... I think that you could do it, may be with TEXTINCLUDE.



    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    I do not do it for the rating. Oh, wait... Sure, I do!
    Vlad - MS MVP [2007 - 2012] - www.FeinSoftware.com
    Convenience and productivity tools for Microsoft Visual Studio:
    FeinWindows - replacement windows manager for Visual Studio, and more...

  3. #3
    Join Date
    Aug 1999
    Posts
    241

    Re: Release vs Debug

    Use Depends that checks what dlls are required to ship with the application. If the Depends display a dll named MFC42D.DLL then it is a debug version. Otherwise if you will see a MFC42.DLL, then it is a release version.

    Hope this help.


  4. #4
    Join Date
    Dec 2000
    Location
    Salmon Arm, BC, Canada
    Posts
    2

    Re: Release vs Debug

    I have discovered that #ifdef with a resource file works just fine for what I want.
    Within the BLOCK "StringFileInfo" this can be one of the STRING values:

    #ifdef _DEBUG
    VALUE "Configuration", "Debug\0"
    #else
    VALUE "Configuration", "Release\0"
    #endif

    The Properties page > Version tab shows the proper Configuration value dependant on whether a Debug or Release version was built.

    This works in MS Visual C++ 5.0 and 6.0 and in Borland C++ Builder 1.0, 3.0, 4.0 and 5.0

    You must edit the .rc files in a text editor and NOT in the IDE's Resource editor. When you view the resource in the IDE you do not see the #ifdef block but it is still there.


  5. #5
    Join Date
    Jun 1999
    Location
    Miami, FL
    Posts
    972

    Re: Release vs Debug

    I don't know if this helps to answer your question but what I usually do is build all my binaries to one folder (which I call "bin"). Then I distinguish between debug and release versions by appending a D to the debug files' names, e.g., toolsD.dll, myAppD.exe. This makes life a lot easier.

    Regards,
    Alvaro


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured