main.cpp:21:17: error: QtGui: No such file or directory
解决:
因为qt3 以前的 include目录里面就直接是头文件了,而qt4的include目录底下还有目录才到头文件,但是qt4的pro出来的makefile的路径只到QTDIR/include 所以qt4的头文件最好是写成
#include <QtGui/***>
#include <Qt/***>
意思就是包含一下include中子目录的名字,再到头文件.
The problem is that include path is not set. Maybe your library path is
not set either. Add the following to the shell(file .bashrc):
export QTDIR=/usr/local/qt
export PATH=$QTDIR/bin:.:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$QTDIR/lib
Then you will be fine.
关于lib路径的问题,我看了下系统的环境变量,QTINC=/usr/lib/qt-3.3/include QTLIB=/usr/lib/qt-3.3/lib 于是我查找相应的/usr/lib/qt4目录下面并没有include和lib目录,在 Kdevelop中,引用的也是QT3的 ... [/quote]
本文解决了Qt4开发环境中因头文件路径设置不当导致的编译错误问题。通过调整环境变量并正确指定Qt4的include和lib路径,确保了Qt4应用程序能够成功编译。
1151

被折叠的 条评论
为什么被折叠?



