Turn on Generation of Debug Information for the Release Build

Overview

You can debug a release build.

To enable debugging of a release build, change the following release build options

  1. On the Project menu, click Settings, and then click the C/C++ tab.

  2. In the Category drop-down box, click General.

  3. In the Debug info drop-down box, click Program Database.

  4. In the Optimizations drop-down box, click Disable (Debug).

  5. On the Link tab, select Generate Debug Info.

These selections correspond to the /Od and /Zi options, which turn off optimizations and place debug information in the build.

After doing this, rebuild and test your program.  If at this point the program works fine, then it is still possible that you have a memory overwrite, but it is also possible that the optimizations are causing problems on a particular piece of code. To isolate that code, see Optimization Problem.

The purpose of turning off optimizations is to help you in debugging the application. With optimizations on, the debugger won't necessarily be able to show you the correct source code and debug information.

You can now debug your release build application. Finding the problem is now a matter of stepping through the code (or of using Just-In-Time debugging) until you find where the failure occurs, and then determine the incorrect parameters or code.