executing Debug vs release builds in Qt

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.


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) {
  CONFIG += debug
  TARGET = $$TARGET-debug
  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

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:

  • debug builds usually generate debug information, release builds not. There are some hybrids though, like release builds with separate debug information.
  • Assertions are not evaluated (assert(p = getFoo()); won't assign anything - nor assert). So expressions with side-effects inside asserts are a bad idea.
  • The optimization settings are usually different (no or few optimizations in debug builds)
  • debug output might be suppressed
  • Any library developer might additionally implement different behavior depending on e.g. the NDEBUG preprocessor macro

Need Your Help

Position of each element of an array initializer

java arrays multidimensional-array array-initialization

So I want to get the position of each of the element within the array initialiser for example:

Accepted App store game crash on two iPhone 4, version 4.3.3

ios crash app-store

Just released my first iOS game on Apple Appstore. (It is accepted by Apple)