Reputation: 2117
Can some one explain other than the debugging symbols being embedded in the debug build, if there is any other difference. Further I am very curious as to know how they differ in executing binary. What mechanisms are being used use debug symbols in the debug build show the errors.
Upvotes: 4
Views: 3962
Reputation: 4862
Compiling as debug in qt sets for one thing the -DQT_NO_DEBUG flag in the compiler call which is used in many qt libraries. As Jimmy already pointed out, the main performance difference comes from this source. One extreme example could be the use of a debug version of STL containers that can be used to check boundaries. If this is used in your code in debug mode things may take a lot longer (Qt does not use this one but introduces similar checks on its libraries).
Further usually the optimization flags are changed. For release -O2 is chosen for release and not optimization for debug
One more important thing about the debug build is that you can use it to trigger different things in a pro file, like adding defines, changing the target or compiling against another set of libraries:
CONFIG(debug, debug|release) {
message("Debug")
DESTDIR = $$DESTDIR-debug
CONFIG += debug
DEFINES += DEBUG
TARGET = $$TARGET-debug
}else{
message("Release")
DEFINES += QT_NO_DEBUG_OUTPUT
DESTDIR = $$DESTDIR-release
TARGET = $$TARGET-release
}
If you're interested in more details take a look at the qmake configuration files. Linux Ubuntu: /usr/share/qt4/mkspecs/common/g++.conf /usr/share/qt4/mkspecs/common/linux.conf and the target dependent conf files
Upvotes: 3
Reputation: 25165
The exact definition and behavior of a "release build" vs. a "debug build" depends on the build system and the compiler you use. Some common properties of release builds compared to debug builds:
Upvotes: 1