首页| 论坛| 消息

标题:【提问】找不到头文件
作者:lcc_zjut
日期:2005-12-23 10:52
内容:

我在redhat9 下安装了Qt4
在etc/profile最后添加
QTDIR=/usr/local/Qt
PATH=$QTDIR/bin:$PATH
MANPATH=$QTDIR/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export QTDIR PATH MANPATH LD_LIBRARY_PATH
安装完打开designer
试着编程代码如下:
#include
#include
#include
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(20,20,160,60);
a.setMainWidget(&mainwindow);
mainwindow.show();
return a.exec();
}
然后,g++ -lqt hello.cpp -o hello 说找不到头文件
换用qmake -prject然后qmake 出现如下说明:
/usr/local/qt/mkspecs/linux-g++/qmake.conf:90: Unknown test function: load
我接着make,出错:
hello.cpp:1:26: qapplication.h: No such file or directory
hello.cpp:2:21: qwidget.h: No such file or directory
hello.cpp:3:25: qpushbutton.h: No such file or directory
不知什么原因,谢谢指教


#1 [XChinux 12-23 11:02]
Linux下是大小写区分的,你上面的QTDIR使用了大写的Qt
是不是这个原因导致失败?
你再检查检查
#2 [lcc_zjut 12-23 14:01]
我改了一下,编译的时候提示说我安装有问题,我重新安装了一边Qt(步骤:1 ./configure 2 make ),然后发现有问题:
kernel/qapplication_x11.cpp: In function `void qt_init(QApplicationPrivate*,
int, Display*, long unsigned int, long unsigned int)':
kernel/qapplication_x11.cpp:1549: `FC_RGBA_UNKNOWN' undeclared (first use this
function)
kernel/qapplication_x11.cpp:1549: (Each undeclared identifier is reported only
once for each function it appears in.)
kernel/qapplication_x11.cpp: In member function `void
QETWidget::translatePaintEvent(const XEvent*)':
kernel/qapplication_x11.cpp:4970: warning: unused variable `QRect clipRect'
make[3]: *** [.obj/debug-shared/qapplication_x11.o] Error 1
make[3]: Leaving directory `/usr/local/qt/src/gui'
make[2]: *** Error 2
make[2]: Leaving directory `/usr/local/qt/src/gui'
make[1]: *** Error 2
make[1]: Leaving directory `/usr/local/qt/src'
make: *** Error 2
然后就停了
这是什么意思,我的linux版本问题,还是qt的版本问题?linux 是redhat qt是4.1.0
#3 [XChinux 12-23 14:09]
configure完成后它提示的是使用gmake ? 还是使用make?
看看Qt Installing置顶贴中我发的Qt 4.1.0安装贴
#4 [lcc_zjut 12-23 14:19]
我是按着它的步骤来的,用gmake但是出错了
然后我换make也错(错误如上)
斑竹,有没有.rpm的安装文件啊
#5 [XChinux 12-23 14:53]
自己到官网找。

回复 发表
主题 版块