Another debugging solution for the vc6.0 Program (release debugging)

Source: Internet
Author: User

 

Vc6.0 is a classic integrated environment for program development. It has created a large number of excellent programs and programmers and is still used in projects until now.

Debugging is very important in programming. I am reluctant to perform unit tests. I believe that debugging will track the execution logic of the program after a function is completed, to meet your requirements. As we all know, vc6.0 has two modes: Debug and release. The difference is that debug adds debugging information and undefined variables give initial values, the release version is the final release version. The program is optimized and the code is small and fast. However, one strange thing that people often encounter is that the debug version program runs normally, after the release, some inexplicable things will occur, exceptions, program logic errors, and so on. What is the cause, I came to the conclusion that some variables of the release version were not correctly initialized, so now it has caused another debugging method.

What method? Debugging information is added to the release version. At the beginning, we program and debug it in the release version. There is no distinction between debug and release for VC, but there are almost some different configurations. So there is no problem with implementing the debug function of release. The following describes the settings.

1. Create a project and delete the debug configuration.

This is the premise, because we only use the release version, so we will delete the debug configuration and leave it in the way. "Build-> deployments", select debug and delete

2. Let the release carry the debug information

The method is simple. You can follow the steps below.

Go to the project> Project Settings> C/C ++ label, set category to general, Optimizations to disable (Debug), and debug info to program database.

Go to project> Project Settings> link and set category to General. Select Generate debug info.

Now, the development environment with debug information for the release version is complete. Except for no optimization, the development environment is the same as that for the release version. If your project is less dependent on VC, you can cancel the pre-compilation header, that is, stdafx. H and stdafx. c. In the C/C ++ label, set category to precompiled headers. Select not using precompiled headers. Generally, this option is not used by experts. H and stdafx. c.

In this environment, the Assembly Code of your project is very clean and replies to the original appearance of the program.

We can see that the sum variable is used without initialization. The value is 4891784, And it is useless!

After the development is complete, change the configuration items optimizations, debug info, and Generate debug info to the original one.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.