[MSDN] How to Debug a Release Build

本文介绍如何在Visual C++中调试发布版构建,包括启用调试信息、禁用增量链接、选择调试模式等步骤。如果程序在调试构建中工作正常,但在发布构建中失败,可能是编译器优化暴露了源代码中的缺陷。文章建议逐步禁用每个源文件的优化,以定位问题。
摘要由CSDN通过智能技术生成

Visual C++ Concepts: Building a C/C++ Program

How to: Debug a Release Build
You can debug a release build.
To enable debugging of a release build, change the following release build options
1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
2. Enable /Z7 or /Zi.
3. Select/INCREMENTAL:NO.
4. Select /DEBUG:Yes.
5. Select /OPT:REF.
6. Select /OPT:ICF.
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.
If a program works in a debug build, but fails in a release build, it is likely that one of the compiler optimizations is exposing a defect in your source code. To isolate the problem, you should disable selected optimizations for each source code file, until you locate the file and the optimization that is causing the problem. For example, you may want to divide the files into two groups, disable optimization on one group, and continue dividing until you isolate the problem to a single file.
You may want to use /RTC to try to expose such bugs in your debug builds.
See Optimizing Your Code for more information.

转载于:https://www.cnblogs.com/Andrewz/archive/2008/10/21/1316019.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值