测试系统CentOS 5.3安装QT4.7后,配置完环境变量:
[root@Linux ~]# pwd
/root
[root@Linux ~]# ls -la .bash_profile
-rw-r--r-- 1 root root 352 Dec 19 13:46 .bash_profile
[root@Linux ~]# vi .bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
#QT PATH
QTDIR=/usr/local/Trolltech/Qt-4.7.4
PATH=$PATH:$HOME/bin:$QTDIR/bin
MANPATH=$QTDIR/doc/man:$MANPATH
LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH
export PATH QTDIR MANPATH LD_LIBRARY_PATH
unset USERNAME
编译测试程序:
#include <QApplication>
#include <QLabel>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLabel *label = new QLabel("Hello Qt!");
label->show();
return app.