Why is the program that the Debug version in the VC can sometimes be running normally under the Release version.

zhaozj2021-02-11  277

When the entire project is large in the VC, the software often runs in the debug state and cannot run in the Release state. Since developers usually develop software in the Debug state, this situation often occurs after we have worked hard for more than one month, and the preparation of confidence will happen when the software is issued. In order to avoid unnecessary losses, we should do the following exams:

1. Two versions of the time test software.

2, do not easily return the problem into debug / release problem unless you have fully tested two versions.

3. Different pretreatment, it is also possible to cause such problems. One possibility of a problem is to define different preprocessing tags between different versions of compilation. Please try the following changes to your Debug version of the software:

Setting the directory (category) in the C / C item in "Project Setting (Alt-F7)" and changes "_debug" defined as "ndebug". Set the directory as "preprocessor" and add definition "_debug to "Undefined symbols" input box. Select Rebuild All to recompile. If you have a problem after compiler, please change the code as follows:

Change assert () to verify (). Because the content in Assert is not compiled in the Release version. Find the code defined in "#ifDef _debug", if you need these code in the Release version, move them to the definition. Find TRACE (...), because these codes are not compiled in Release. So please carefully check if the code you need in Release is not compiled.

4, the difference in the initialization of variables, there is such differences between different systems, or between Debug / Release versions, so please initialize variables.

5, is there a warning when compiling? Set the warning level to 3 or 4, and then ensure that there is no warning when compiling.

6. Is there a resource file?

7. In addition to the Release version of the software, you can make a debugger, please do the following changes:

Set "CATEGORY" to "General" under "Project Settings" in "Project Settings" and set "Debug Info" to "Program Database". In the "Link" project, "Generate Debug Info" check box is selected. "Rebuild All" will result in some restrictions:

The value of variables in the MFC DLL cannot be obtained. All DLL projects used in this software must be changed.

Another: MS BUG: A technical documentation of MS indicates that the "Maximize Speed" optimization option for the DLL in VC5 is not fully supported, so this will cause memory errors and cause the program to crash.

转载请注明原文地址:https://www.9cbs.com/read-3918.html

New Post(0)