Results 1 to 4 of 4
Hello Friends,
I'm learning Qt 4 and I tried to compile a simple 'Hello Qt' program but the compiler gives error even though the source code is correct.
Please help ...
- 06-03-2008 #1
Compiling Qt 4 program in Fedora 9
Hello Friends,
I'm learning Qt 4 and I tried to compile a simple 'Hello Qt' program but the compiler gives error even though the source code is correct.
Please help me out of this.
My program source code is:
hello.cpp
Code:#include <QApplication> #include <QLabel> int main(int argc, char *argv[]) { QApplication app(argc, argv); QLabel *label = new QLabel("Hello Qt!"); label->show(); return app.exec(); }
and after qmake -project and qmake hello.pro, the make gives the following warning:
Code:hello.cpp:1:24: error: QApplication: No such file or directory hello.cpp:2:18: error: QLabel: No such file or directory hello.cpp: In function ‘int main(int, char**)’: hello.cpp:5: error: ‘QApplication’ was not declared in this scope hello.cpp:5: error: expected `;' before ‘app’ hello.cpp:6: error: ‘QLabel’ was not declared in this scope hello.cpp:6: error: ‘label’ was not declared in this scope hello.cpp:6: error: expected type-specifier before ‘QLabel’ hello.cpp:6: error: expected `;' before ‘QLabel’ hello.cpp:8: error: ‘app’ was not declared in this scope hello.cpp: At global scope: hello.cpp:3: warning: unused parameter ‘argc’ hello.cpp:3: warning: unused parameter ‘argv’ make: *** [hello.o] Error 1
What should I do?
- 06-03-2008 #2
hi,
you are including the wrong files.
instead of
doCode:#include <QApplication> #include <QLabel>
Code:#include <qapplication.h> #include <qlabel.h>
Linux and me it's a love story
- 06-03-2008 #3
I want to use Qt 4. The solution you suggested is for Qt 3 users...
Please help me compile with Qt 4.
- 06-03-2008 #4
sorry i havent used qt4.
but try to use
Code:/usr/bin/qmake-qt4 -project /usr/bin/qmake-qt4 make
Linux and me it's a love story


Reply With Quote