Debugging a Release Build
You can debug a release build.
To enable debugging of a release build, change the following release build options
- Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
- In the C/C++ folder, select the General property page.
- For the Debug Information Format property, click Program Database (/Zi).
- In the C/C++ folder, select the Optimization property page.
- For the Optimization property, click Disabled (/Od).
- In the Linker folder, select the Debug property page.
- For the Generate Debug Info property, select Yes (/DEBUG).
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 Optimizing Your Code.
The purpose of turning off optimizations is to help you debug 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. To find the problem, step 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.