我今天才刚刚装的QT,都不是很清楚.
下面是我摘抄<21天学懂QT>的一个程序:
#include <qapplication.h>
#include <qwidget.h>
#include <qpushbutton.h>
int main(int argc,char **argv)
{
QApplication a(argc,argv);
QWidget mainwindow;
mainwindow.setMinimumSize(200,100);
mainwindow.setMaximumSize(200,100);
QPushButton helloworld("Hello World!",&mainwindow);
helloworld.setGeometry(&mainwindow);
mainwindow.show();
return a.exec();
}
运行以后就出现下面的错误了,请大侠帮帮忙.
(注:RH9,QT版本是从论坛上下的,qt-x11-opensource-src-4.1.0)
[root@202 Qt]# gcc -lqt HelloWorld.cpp
HelloWorld.cpp:1:26: qapplication.h: 没有那个文件或目录
HelloWorld.cpp:2:21: qwidget.h: 没有那个文件或目录
HelloWorld.cpp:3:25: qpushbutton.h: 没有那个文件或目录
HelloWorld.cpp: In function `int main(int, char**)':
HelloWorld.cpp:7: `QApplication' undeclared (first use this function)
HelloWorld.cpp:7: (Each undeclared identifier is reported only once for each
function it appears in.)
HelloWorld.cpp:7: parse error before `(' token
HelloWorld.cpp:9: `QWidget' undeclared (first use this function)
HelloWorld.cpp:10: `mainwindow' undeclared (first use this function)
HelloWorld.cpp:13: `QPushButton' undeclared (first use this function)
HelloWorld.cpp:13: parse error before `(' token
HelloWorld.cpp:14: `helloworld' undeclared (first use this function)
HelloWorld.cpp:16: `a' undeclared (first use this function)