Developing UI Framework with Qt and Eclipse in Linux

Qt is a cross-platform application and UI framework for developers using C++, which can be used to build UI solutions in Windows, Linux or Mac. This tutorial describes the necessary steps for setting a development environment using Eclipse IDE in Linux Machines.

Qt UIeclipse

These commands are tested in Ubuntu 13.10, LinuxMint 15 with Eclipse Juno 3.8.1

First step is to install Eclipse- C++ Development Tool in linux. Use the following command

sudo apt-get update

sudo apt-get install build-essential

sudo apt-get install eclipse-cdt

Install the Qt development tools by entering the command

sudo apt-get install libqt4-dev

Create new C++ executable project from Eclipse–> File –> New and create a source file main.cpp.

Under Project–>Properties–>C/C++ Build–>Settings–>GCC C++ Compiler–>Includes add the following include files

/usr/include/qt4
/usr/include/qt4/Qt
/usr/include/qt4/QtCore
/usr/include/qt4/QtGui

Properties for Qt_Test  (as superuser)_001

Under Project–>Properties–>C/C++ Build–>Settings–>GCC C++ Linker–>Libraries add the following

QtCore
QtGui

Properties for Qt_Test Include Paths

Copy the sample code below for getting started

#include<QApplication>
#include<QLabel>
int main(int argc, char *argv[]) {
QApplication a(argc, argv);
QLabel label;
label.setText("Hello World");
label.show(); a.exec();
}

Compile the program using Project–>Build All or by Ctrl+B shortcut. Program should be compiled successfully and an executable binary should be formed inside the Project Workspace.

Debug the program using Run–>Debug as–>Local C/C++Application.

You should see a Window Opened with “Hello World” displayed in it.

Advertisements

11 thoughts on “Developing UI Framework with Qt and Eclipse in Linux

  1. Thanks!
    It works but I have this error message on debian:
    Qt: Session management error: None of the authentication protocols specified are supported

  2. When i do the same thing in Windows 7, Eclipse CDT. I dont see any window pop up. there is no error but there is no output either.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s