Code::Blocks Settings for Qt Development

Qt is a cross-platform object oriented C++ framework for application development. KDE is written using Qt. And not surprisingly, KDE comes with native support for building Qt based applications. In KDE, KDevelop is the default IDE under Linux for creating Qt based applications. For smaller projects however, it seems that the feature richness of KDevelop is almost an overkill.

I personally like simplicity of Code::Blocks when writing small programs. Even though Code::Blocks does come with Qt support, you will have to tell it where Qt is installed before you can compile your code correctly. Like any other C++ environment, the two things you must provide are the include path and the linker path.

Ubuntu 8.04 comes with Qt3 installed, to install Qt4, please follow the instructions here. Here are the build options you need to add with the default Qt4 install:



As a bare minimum, you will need to set the libQtGui and libQtCore libraries paths. Note thatUbuntu 8.04 comes with Qt3 installed, when you specify the libraries you need to make sure you specify the ones with the correct version. In my example, the required Qt4 libraries are /usr/lib/ and /usr/lib/ You also need to specify where the include files can be found. For typical applications, /ur/incude/qt4 and /usr/include/qt4/QtGui are the paths you will need. If you want contextual help to be available, you will have to provide the search paths for the include files under "C/C++ parser options" tab in Project/targets options settings.

Be Sociable, Share!


  1. Juan Hito says:

    when you creates a first project en Code::Blocks for Qt4 it requires a global variable to be set, base variable should be set to /usr/include/qt4 (base and include values), and /usr/lib/qt4 (lib value)

Leave a Reply