Two versions of debug and release can be generated in the compiling environment of VC. The differences are as follows:
Debug is usually called a Debug version. It contains debugging information without any optimization, so that programmers can Debug programs easily. Release is called a Release version. It is often optimized to optimize the code size and running speed, so that users can use it well.
The real secret of Debug and Release lies in a set of compilation options. The options for the two are listed below (of course there are other options, such as/Fd/Fo, but the difference is not important. Usually they will not cause a Release version error)
Debug version
Parameter description
/MDd/MLd or/MTd use the Debug runtime library (the runtime function library of the Debug version)
/Od turn off the optimization Switch
/D "_ DEBUG" is equivalent to # define _ DEBUG. Enable the compile and DEBUG code switch (mainly for the assert function)
/ZI creates the Edit and continue database, so that the source code does not need to be re-compiled if the source code is modified during the debugging process.
/GZ helps capture Memory Errors
/Gm enables the minimize reconnection switch to reduce the link time
Release Version
Parameter description
/MD/ML or/MT use the runtime function library of the released version
/O1 or/O2 optimization switch to minimize or minimize the program
/D "NDEBUG" Disable the Conditional compilation and debugging code switch (that is, do not compile the assert function)
/GF combines repeated strings and puts string constants in read-only memory to prevent Modification
In fact, there is no essential limit between Debug and Release. They are just a set of compilation options, and the compiler only acts according to the predefined options. In fact, we can even modify these options to get optimized debugging versions or release versions with trace statements.