Thread: Compiled App as release - won't run - as debug runs

  1. #1
    Registered User
    Join Date
    Jun 2002
    Posts
    31

    Compiled App as release - won't run - as debug runs

    Could someone give me a few suggestions here:

    I am using Visual C++ 6 Enterprise. I have written a small program that plays a wave file...

    Application Type: Win32 Application (not console)
    Using MFC: No

    Program Description:

    The program opens a data file and reads the first line to get the path to the wave file, then plays it using PlaySound. If either the data file or wave file can't be found, it displays a messagebox and then exits.

    When compiled as "Debug", it works fine...and if I rename the data file, the messagebox appears and then the program closes...

    I switch my "active build configuration" to "Release", compile and when I run it, it says it can't find the configuration file (yes, I named it back to the original). Also, instead of the messagebox having the message "Can't find data file", it is just filled with a bunch of crap and the title is the path to my executable, not the title I told it to display...

    So I'm curious why this happened. I did not change any code from "Debug" to "Release".

    Any ideas?
    Welcome to the funhouse, where strange mirrors reflect the faces of insanity.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Is this config file in project\debug

    Because the release build is in project\release, so that's where it might start looking

  3. #3
    Registered User
    Join Date
    Jun 2002
    Posts
    31
    I put a copy of the config file in both folders. But the only executable that works is the one in the debug folder.

    The wierdest part is as I mentioned, there is absolutely nothing different about the two .EXEs (except for the debug info that increases the size of the debug build).

    I wonder if it may have to do with some of the linker switches. I didn't change them from the default and I know the debug build has different switches than the release build... just because a compile doesn't report any errors doesn't mean it worked...

    If it would make it easier, I can post the code ina couple hours... I don't have it with me here at work.
    Last edited by XenoCodex Admin; 07-25-2002 at 01:21 PM.
    Welcome to the funhouse, where strange mirrors reflect the faces of insanity.

  4. #4
    Registered User Dual-Catfish's Avatar
    Join Date
    Sep 2001
    Posts
    802
    I find one of the most common causes of this is buffer overflows. Use the debugger to check your array bounds.

  5. #5
    Registered User
    Join Date
    Jun 2002
    Posts
    31
    Ok. What would I look for in the debugger?

    I can't debug the release version because it doesn't contain any debugging information.

    And since the debug version works, I wouldn't see anything wrong in there.
    Welcome to the funhouse, where strange mirrors reflect the faces of insanity.

  6. #6
    Registered User
    Join Date
    Apr 2002
    Posts
    1,571
    Originally posted by XenoCodex Admin
    Ok. What would I look for in the debugger?

    I can't debug the release version because it doesn't contain any debugging information.

    And since the debug version works, I wouldn't see anything wrong in there.
    Use assertions or try, catch and throw to debug your program. Check all return values and ensure any dynamically allocated memory was actually given to you. Also try just copy both EXE's out to a neutral directory and seeing if they both still work.

  7. #7
    Unregistered
    Guest
    check whether you have initialized the pointer, it is usually handled in debug mode but not in release mode.

    Most likely it is a memory mishandling.

    what do I know?

  8. #8
    Registered User
    Join Date
    Dec 2001
    Posts
    421
    there could be quite a few reasons. the things to focus on would be bounds checking, initialising your structures/arrays/pointers to zero, and cleaning up memory properly.

    if you are still stuck, post your code and i'll check it out for ya.

    U.
    Quidquid latine dictum sit, altum sonatur.
    Whatever is said in Latin sounds profound.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Release and Debug builds dont work
    By garethmaguire in forum C# Programming
    Replies: 3
    Last Post: 04-10-2003, 01:58 PM
  2. step by step debug != run debug
    By bonkey in forum Windows Programming
    Replies: 8
    Last Post: 09-09-2002, 12:55 PM
  3. Differences in Debug and Release builds in MSVC
    By TravisS in forum C Programming
    Replies: 5
    Last Post: 06-19-2002, 10:40 PM
  4. Ask about Debug Assert Failed
    By ooosawaddee3 in forum C++ Programming
    Replies: 0
    Last Post: 04-24-2002, 11:07 PM
  5. How to run VC++ App on the other PC
    By zigona in forum C++ Programming
    Replies: 4
    Last Post: 11-21-2001, 04:47 PM