First Qt Application

From ArkWiki

Jump to: navigation, search

I was wondering about how short can a qt application be so I try to write the standard "Hello World" application using qt4.

Create a file called test.cpp containing the following:

 
#include <QString>

int main()
{
        QString str("Hello Ark!!!");
        qDebug(str.toLatin1());

        return 0;
}

Create a make file called Makefile containing the following:

TARGET = test
OBJECT = test.o
CXXFLAGS = -I/usr/lib/qt4/include/QtCore
LIBS = -lQtCore
$(TARGET): $(OBJECT) $(LIBS)

Compile it: # make

Run it: # ./test


You should see "Hello Ark!!!" printed on the screen. If you have some idea to make even shorter Qt application, do let me know.

--Deux 05:43, 28 February 2008 (UTC)

Personal tools