准备工作
sudo apt-get install qt4-dev-tools qt4-doc qt4-qtconfig qt4-demos qt4-designer
sudo apt-get install libfontconfig*
1:下载Qt 4.8.1安装包,自行百度
下载下来的应该是:qt-everywhere-opensource-src-4.8.1.tar.gz
2:拷贝文件到自己想要解压的目录下,再进行解压
tar zxvf qt-everywhere-opensource-src-4.8.1.tar.gz
3:进入解压目录后,进行配置
./configure
配置过程中会有提示:
Which edition of Qt do you want to use ?Type 'c' if you want to use the Commercial Edition.Type 'o' if you want to use the Open Source Edition.
选择o,
接下来还有提示:
This is the Open Source Edition.You are licensed to use this software under the terms ofthe Lesser GNU General Public License (LGPL) versions 2.1.You are also licensed to use this software under the terms ofthe GNU General Public License (GPL) versions 3.Type '3' to view the GNU General Public License version 3.Type 'L' to view the Lesser GNU General Public License version 2.1.Type 'yes' to accept this license offer.Type 'no' to decline this license offer.Do you accept the terms of either license?
输入yes
,然后回车。等待几分钟,会生成Makefile文件, 配置完后执行make就可以了。
编译完成后,执行
sudo make install
这样会安装到/usr/local/Trolltech/Qt-4.8.1目录下。
运行Qt Creator,在标题栏“工具”的“选项”中添加qmake路径
参考自https://www.aliyun.com/jiaocheng/173020.html