What is the difference between Release and Debug modes in Visual Studio while building a project?

Recommended Answers

All 4 Replies

The compiler and linker have various options. Your project settings control what options are used. Release and Debug use different sets of options.

Debug will choose options such as including debug symbols (to make debugging easier) and less (or no) optimisation. Release will typically not include debugging symbols and will use optimisation.

You should examine the settings yourself and see what options are being used for both. It is very likely that at some point you will want to add more modes yourself, or change existing ones. For example, sometimes a bug will exist only when optimisation is turned on, so the bug will disappear in debug mode (because optimisation is turned off), making it very hard to track down the bug unless you create a build option with optimisation and debug symbols. Alternatively, there is a difference between optimising for speed and optimising for size. If you ever want to give priority to one over the other, you will need to learn the options.

Additionally, the Debug and Release versions link to different libraries. If you compile a program in Debug mode, it will only work on a computer that has Visual Studio installed. To let someone else that doesn't have Visual Studio run your program, you have to compile it as a Release version.

Debug: When you test your software to check for error, and the result..(Test phase)

Release:When you want to deploy your software..(The final product)

Normal SDLC process

There are also other subtle differences. A program that runs ok when compiled in Debug mode may be broken when compiled in Release mode. One reason for that behavior is the way the compiler allocates memory for variables when compiled for Debug. Another reason may be over optimization in Release mode.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.