Ubuntu 16.04 LTS安装Qt

本文转载于http://www.linuxidc.com/Linux/2017-03/141553.htm

开发需要,在 Linux下安装Qt Creator。我电脑装的是Ubuntu 16.04 LTS,其它的应该相同!

1.Qt下载

关于Qt下载,比较机智的同学都回去官网直接download,但是步骤相当繁琐!大家可以打开下面的链接,里面有各版本Qt,操作简单,童叟无欺!http://download.qt.io/archive/qt/

我下载的Linux版是5.5.1,大家根据需要下载x86或x64版本

ubuntu下载:wget  http://download.qt.io/archive/qt/5.6/5.6.0/qt-opensource-linux-x64-5.6.0.run

2.安装

首先要cd进入软件安装包的目录,然后取得安装权限,进行图形化安装,如下:

[email protected]:~$ cd /home/linuxidc/soft 

[email protected]:~/soft$ chmod +x qt-opensource-linux-x86-5.5.1.run 

[email protected]:~/soft$ ./qt-opensource-linux-x86-5.5.1.run

3.安装过程几乎一路next,在选择时如果需要Assistant,想学习官方源码就select all就可以了。等待安装完成

4.Qt以C/C++为依托,用Python也可,先检查一下有没有gcc/g++编译器,没有的话动手安装,不多说了

5.如果系统没有自带openGL库时,在做带有3D效果的界面会报错,手动安装openGL

sudo apt-get install mesa-common-dev 

sudo apt-get install libglu1-mesa-dev -y

完成!

运行官方示例程序如下:

在Ubuntu Linux上安装搜狗输入法及对Qt Creator的支持   http://www.linuxidc.com/Linux/2015-01/111651.htm

Linux下为刚安装好的Qt Creator 创建桌面启动图标 http://www.linuxidc.com/Linux/2012-08/67214.htm

Ubuntu 11.04安装QT Creator 2.5.0 http://www.linuxidc.com/Linux/2012-06/62607.htm

Qt creator for PlayBook安装过程 http://www.linuxidc.com/Linux/2012-05/60652.htm

Ubuntu 15.04下QT Creator支持中文输入  http://www.linuxidc.com/Linux/2016-03/129198.htm

Qt Creator 的详细介绍请点这里 
Qt Creator 的下载地址请点这里

本文永久更新链接地址http://www.linuxidc.com/Linux/2017-03/141553.htm



gstapp-0.10库的安装    

 sudo apt-get install libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev




qmake: could not exec ‘/usr/lib/x86_64-linux-gnu/qt4/bin/qmake’: No such file or directory
经查阅资料得知是qtchooser默认选择路径中没有指向qmake路径。注:qtchoooster在/usr/lib/x86_64-linux-gnu/qt-default/中。

(找不到qt安装包命令的路劲,需要手动指定一下qt的命令集在哪里,就是指定一下path路劲)
解决办法:转载于http://blog.csdn.net/zhuquan945/article/details/52818786

将/usr/lib/x86_64-linux-gnu/qt-default/qtchoooster的default.conf文件中的第一行改为:/home/zhuquan/Qt5.7.0/5.7/gcc_64/bin
但default.conf文件是只读的,所以要改下权限:
[email protected]:~$ sudo chmod 777 /usr/lib/x86_64-linux-gnu/qt-default/qtchooser/default.conf
然后在default.conf文件中写入
/home/zhuquan/Qt5.7.0/5.7/gcc_64/bin(注:此为qmake所在的路径)
/usr/lib/x86_64-linux-gnu
改好,保存。
再在终端输入:
[email protected]:~$ qmake -v
显示结果为:
QMake version 3.0
Using Qt version 5.7.0 in /home/zhuquan/Qt5.7.0/5.7/gcc_64/lib