On some programming forums, I often see that some people ask me that the program is good under Debug, But it crashes when it reaches Release, or it is good under Release, however, if a problem such as failure occurs under Debug, it is best to solve this problem. As long as you trace it in one step, check its call stack, and the function call sequence, the error will be displayed at a glance. Generally, the error is either an operation on the NULL pointer, or the memory to be released is not as big as it was originally applied for, or the memory to be applied for is called multiple times and so on ......
Therefore, debugging is the first technology to be mastered by programmers. It can be said that no debugging means no programming. VC ++ 6.0 comes with a very good debugging tool, which is very convenient to use. You can start by clicking F5. The single step is F10, and the single step is F11 .. I will not talk much about the debugging technology. There are many things in it. There are several Debug-related windows, including Watch, Variables, and Call Stack.
However, we all know that in the Release mode, single-step debugging is not allowed (in fact, not debugging, but Source Code cannot be tracked) and breakpoint setting, because the program compiled in this way does not contain debugging symbols, we can only get the assembly code when there is an error, but cannot confirm that it is an error in the source code.
How can we achieve single-step and breakpoint in the Release mode? It's easy. Set it as follows:
1. Step 1: Open the Project menu-> Setting..., select the Project to be set, and select "Win32 Release ":
2. Step 2: select the C/C ++ Tab, and then select "Program Database" in Debug Info: list"
3. Step 3: select the Link Tab and select "Generate debug info"