Qt 4 C++ development with Qt 4 Creator or Netbeans on Ubuntu Linux

Qt logoSo you want to develop GUI applications using Qt4 framework on Ubuntu Linux? No problem. Everything what you need is at the tip of you fingertips (official Ubuntu repository to be exact). Here's what you need to do to have Qt 4 Assistant, Qt 4 Designer, Qt 4 Linguist and last but not least important Qt 4 Creator (following is all one line at the terminal):

sudo apt-get install build-essential qt4-designer qtcreator qtcreator-doc qt4-demos qt4-doc qt4-dev-tools libqt4-dev

Now feel free to go to Applications -> Programming -> Qt 4 Creator and do something creative.

Qt 4 C++ Netbeans development

But what if you want to use Netbeans to develop Qt 4 C++ applications? Piece of cake. Follow me... First step is to install Netbeans (you've probably guessed that one).

sudo apt-get install netbeans

Next step is to start Netbeans by going to the Applications -> Programming -> Netbeans. Netbeans is primarily Java IDE so we must make sure that Netbeans has C++ support plugin. So inside Netbeans interface we go to Tools -> Plugins and then switch to "Installed" tab. Here we must make sure that "C/C++" plugin is amongst installed plugins. If not, we switch to "Available plugins" tab and put checkbox next to "C/C++" plugin and click install at the bottom of the dialog. After "C/C++" plugin is installed along with it we acquired Qt 4 project support for Netbeans.

But there is one thing we must do before we start coding. We must tell Netbeans the path to the "qmake-qt4" program necessary to compile Qt 4 applications. We need to go to Tools -> Options and switch to the "C/C++" tab. Next to the "QMake Command" label we must enter path to the "qmake-gt4" program. If you are using Ubuntu Linux operating system you need to enter this path:

/usr/bin/qmake-qt4

Now click OK and find "Hello World" tutorial like this one. So here you go, now you have full blown Qt 4 development environment inside you Ubuntu box.

DevGenii

A quality focused Magento specialized web development agency. Get in touch!

One thought on “Qt 4 C++ development with Qt 4 Creator or Netbeans on Ubuntu Linux

  1. Mohamed

    “/usr/bin/make” -f nbproject/Makefile-Debug.mk QMAKE=/usr/bin/qmake SUBPROJECTS= .build-conf
    make[1]: Entering directory `/home/mohamed/NetBeansProjects/HelloQtWorld_1′
    /usr/bin/qmake VPATH=. -o qttmp-Debug.mk nbproject/qt-Debug.pro
    mv -f qttmp-Debug.mk nbproject/qt-Debug.mk
    “/usr/bin/make” -f nbproject/qt-Debug.mk dist/Debug/GNU-Linux-x86/HelloQtWorld_1
    make[2]: Entering directory `/home/mohamed/NetBeansProjects/HelloQtWorld_1′
    g++ -c -m64 -pipe -g -Wall -W -D_REENTRANT -fPIE -DQT_GUI_LIB -DQT_CORE_LIB -I/usr/share/qt5/mkspecs/linux-g++-64 -Inbproject -I/usr/include/qt5 -I/usr/include/qt5/QtGui -I/usr/include/qt5/QtCore -I. -I. -o build/Debug/GNU-Linux-x86/HelloForm.o HelloForm.cpp
    In file included from HelloForm.cpp:31:0:
    HelloForm.h:34:26: fatal error: ui_HelloForm.h: No such file or directory
    #include “ui_HelloForm.h”
    ^
    compilation terminated.
    make[2]: *** [build/Debug/GNU-Linux-x86/HelloForm.o] Error 1
    make[2]: Leaving directory `/home/mohamed/NetBeansProjects/HelloQtWorld_1′
    make[1]: *** [.build-conf] Error 2
    make[1]: Leaving directory `/home/mohamed/NetBeansProjects/HelloQtWorld_1′
    make: *** [.build-impl] Error 2

    BUILD FAILED (exit value 2, total time: 115ms)

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *