Linux下安装Qt 4

1.安装必要的库

sudo apt-get install g++

sudo apt-get install libx11-dev libxext-dev libxtst-dev

其中,libx11-dev中11为阿拉伯数字11。libx*,x为小写。

如果库名字写错会提示:"E: Unable to locate package libX11-dev" 错误。

如果不安装这三个库,第2步configure时会提示“Basic XLib functionality test failed! You might need to modify the include and library search paths...”错误。

2.下载Qt

Linux下下载qt-everywhere-opensource-src-4.8.7.tar.gz 版本

3.解压

tar xzvf qt-everywhere-opensource-src-4.8.7.tar.gz

4、配置

cd进入解压目录

./configure

系统提示'c' or 'o',c代表商业版,o代表开源版,键盘输入o

5、安装

第4步完成后系统提示以下信息:

Qt is now configured for building. Just run 'make'.

Once everything is built, you must run 'make install'.

Qt will be installed into /usr/local/Trolltech/Qt-4.8.7

To reconfigure, run 'make confclean' and 'configure'.

输入:

make

sudo make install //(这一步一定要有sudo)

6、检查是否安装成功

进入Qt安装目录所在的bin文件夹

cd /usr/local/Trolltech/Qt-4.8.7/bin

之后输入:

./qmake -v

系统显示:

QMake version 2.01a

Using Qt version 4.8.7 in /usr/local/Trolltech/Qt-4.8.7/lib

表示安装成功。

猜你喜欢

转载自blog.csdn.net/u014726567/article/details/79852767