jonathanmotes
March 12th, 2008, 10:52 PM
I'm trying to learn to use qt, starting with the example qt code at http://doc.trolltech.com/4.3/tutorial-t1.html. I've installed everything that was asked for when I tried to compile the first time (libqt4-dev and qt3-dev-tools), and I have build-essential.
Here's the code:
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
I run these commands:
qmake -project
qmake
make
and I get this:
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ sudo qmake -project
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ qmake
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ make
g++ -c -pipe -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/share/qt3/include -o main.o main.cpp
main.cpp:6:25: error: QApplication: No such file or directory
main.cpp:7:24: error: QPushButton: No such file or directory
main.cpp: In function ‘int main(int, char**)’:
main.cpp:11: error: ‘QApplication’ was not declared in this scope
main.cpp:11: error: expected `;' before ‘app’
main.cpp:13: error: ‘QPushButton’ was not declared in this scope
main.cpp:13: error: expected `;' before ‘hello’
main.cpp:14: error: ‘hello’ was not declared in this scope
main.cpp:17: error: ‘app’ was not declared in this scope
main.cpp: At global scope:
main.cpp:9: warning: unused parameter ‘argc’
main.cpp:9: warning: unused parameter ‘argv’
make: *** [main.o] Error 1
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$
In case it helps, here's the files in the Hello_World directory:
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ ls -l
total 16
-rw-r--r-- 1 jmotes1 jmotes1 286 2008-03-12 16:50 Hello_World.pro
-rw-r--r-- 1 jmotes1 jmotes1 479 2008-03-12 15:36 main.cpp
-rw-r--r-- 1 jmotes1 jmotes1 479 2008-03-12 15:36 main.cpp~
-rw-r--r-- 1 jmotes1 jmotes1 2792 2008-03-12 16:50 Makefile
Any Ideas anyone?
Thanks!
Here's the code:
#include <QApplication>
#include <QPushButton>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QPushButton hello("Hello world!");
hello.resize(100, 30);
hello.show();
return app.exec();
}
I run these commands:
qmake -project
qmake
make
and I get this:
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ sudo qmake -project
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ qmake
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ make
g++ -c -pipe -Wall -W -O2 -D_REENTRANT -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I/usr/share/qt3/mkspecs/default -I. -I. -I/usr/share/qt3/include -o main.o main.cpp
main.cpp:6:25: error: QApplication: No such file or directory
main.cpp:7:24: error: QPushButton: No such file or directory
main.cpp: In function ‘int main(int, char**)’:
main.cpp:11: error: ‘QApplication’ was not declared in this scope
main.cpp:11: error: expected `;' before ‘app’
main.cpp:13: error: ‘QPushButton’ was not declared in this scope
main.cpp:13: error: expected `;' before ‘hello’
main.cpp:14: error: ‘hello’ was not declared in this scope
main.cpp:17: error: ‘app’ was not declared in this scope
main.cpp: At global scope:
main.cpp:9: warning: unused parameter ‘argc’
main.cpp:9: warning: unused parameter ‘argv’
make: *** [main.o] Error 1
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$
In case it helps, here's the files in the Hello_World directory:
jmotes1@dell-desktop:~/Projects/Qt/Hello_World$ ls -l
total 16
-rw-r--r-- 1 jmotes1 jmotes1 286 2008-03-12 16:50 Hello_World.pro
-rw-r--r-- 1 jmotes1 jmotes1 479 2008-03-12 15:36 main.cpp
-rw-r--r-- 1 jmotes1 jmotes1 479 2008-03-12 15:36 main.cpp~
-rw-r--r-- 1 jmotes1 jmotes1 2792 2008-03-12 16:50 Makefile
Any Ideas anyone?
Thanks!