一、开发环境
ubuntu版本:Ubuntu 16.04 64位;
qt下载链接:http://download.qt.io/official_releases/qt/
二、安装准备(不用这一步也可能安装成功)
安装qt系统库和g++编译器
sudo apt-get install g++
sudo apt-get install libx11-dev libxext-dev libxtst-dev
sudo apt-get install xlibmesa-gl-dev libglu1-mesa-dev
三、安装QT
sudo chmod 777 qt-opensource-linux-x64-5.12.0.run
sudo ./qt-opensource-linux-x64-5.8.0.run
根据安装程序一步步安装,注意不要忘记选择自己需要的组件(特别是相应的编译器)!!!
四、环境配置
打开/etc/profile文件,该文件是每个用户登录时都会运行的环境变量设置 .bashfile 是单用户登录时比如root会运行的。
vim /etc/profile
在文件末尾添加
export PATH="/home/hf/Qt5.12./Tools/QtCreator/bin:$PATH"
export PATH="/home/hf/Qt5.12.0/5.12.0/gcc_64/bin:$PATH"
注意:/home/hf/Qt5.12.0/即你的qt安装路径
保存profile文件后执行source /etc/profile命令即可修改环境变量
终端下执行qtcreator命令即可打开Qt,执行qmake命令即可执行该命令
参考链接:
https://blog.youkuaiyun.com/kenjianqi1647/article/details/80151932
https://blog.youkuaiyun.com/liuxing__jacker/article/details/81195107
https://blog.youkuaiyun.com/jcs1992/article/details/81506880
http://www.360doc.com/content/18/0130/17/18635950_726458821.shtml