官网介绍:https://wiki.qt.io/Install_Qt_5_on_Ubuntu

Install Qt 5 on Ubuntu

Introduction

This is a tutorial for installation of Qt 5.7.0 to Ubuntu 12.10. It may be used for some newer versions of Qt and Ubuntu. As a counterexample, Ubuntu 16.04 LTS uses an independent system for controlling the Qt version. Following these directions for Ubuntu 16.04 results in an error where a file can't be found in a qt4 directory, even though you're installing qt5 not 4. Another difference for OpenGL has been found and added as a note below.

Installation Guide

强烈建议从 http://download.qt.io/official_releases/qt 下载

  • Download

Visit Qt downloads page an download a 32-bit or 64-bit Linux installation depending your version of Ubuntu. The installation file can be also downloaded through the command line using wget.

Example:

wget http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
  • Install

Adjust permission, run the installer and follow the instruction to complete the installation.

chmod +x qt-opensource-linux-x64-5.7.0.run
./qt-opensource-linux-x64-5.7.0.run
  • Install g++

Open a terminal and execute the following command to install g++:

sudo apt-get install build-essential
  • Install generic font configuration library - runtime

Open a terminal and execute the following command to install the full runtime files for the generic font configuration library:

sudo apt-get install libfontconfig1
  • Configure a compiler

Launch Qt Creator. Go to Tools > Options. Click Build & Run and select tab Kit. Configure a compiler if it is not automatically detected.

  • Install OpenGL libraries

Execute the following command to install OpenGL libraries:

sudo apt-get install mesa-common-dev

Note: Just installing the above-mentioned mesa-common-dev kit is not sufficient for more recent Ubuntu versions. Based on a comment in the Qt forum[1] an additional package needs installation. Execute following command:

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

Tested with Qt5.3.1 and Ubuntu 14.04 and it solved the problem with missing -lGL.

  • Set file association with pro files

When installing from the on-line source the file association is not done automatically. It also not show up when you try to associate it with file explorer. Create a file named “Qt-Creator.desktop” and fill the file with the following.

[Desktop Entry]
Version=1.0
Encoding=UTF-8
Type=Application
Name=QtCreator
Comment=QtCreator
NoDsiplay=true
Exec=(Install folder of QT)/Tools/QtCreator/bin/qtcreator %f
Icon=(Install folder of QT)/5.4/Src/qtdoc/doc/images/landing/icon_QtCreator_78x78px.png
Name[en_US]=Qt-Creator

Place this file in home .local/share/applications .

Edit a file named “defaults.list” in the same directory . Add the following line.

text/qtcreator=Qt-Creator.desktop;

open file mimeapps.list and check if the following line is present.

application/vnd.nokia.qt.qmakeprofile=qtcreator.desktop

if not add it under [added Associations].

Run the following command.

sudo update-mime-database /usr/share/mime

now Qt has been added to the list of file associations.

Troubleshooting

  • Qt Creator needs a compiler set up to build

Follow the instruction from the previous section to configure compiler for Qt Creator.

  • error: g++: Command not found

Solution:

sudo apt-get install build-essential
  • error: GL/gl.h: No such file or directory

Solution:

sudo apt-get install mesa-common-dev

References

  1. Jump up↑ Qt 5.5.0 problem running examples [SOLVED]. 2015-09-22. Archived from the original on 2016-08-01. Retrieved 2016-08-01.

    Execute the following command to install OpenGL libraries: sudo apt-get install mesa-common-dev Note: Just installing the above-mentioned mesa-common-dev kit is not sufficient for more recent Ubuntu versions. Based on this comment in the forum an additional package needs installation. Execute following command: sudo apt-get install libglu1-mesa-dev -y Tested with Qt5.3.1 and Ubuntu 14.04 and it solved the problem with missing -lGL.

Qt ------ 在 ubuntu 内安装 Qt creator的更多相关文章

  1. Ubuntu 下安装QT

    Ubuntu 下安装QT 本文使用的环境 QT Library: qt-everywhere-opensource-src-4.7.4.tar.gz QT Creator: qt-creator-li ...

  2. (转载)Ubuntu下安装Qt

    转载自:http://blog.csdn.net/timidsmile/article/details/7716201 Ubuntu下安装Qt 1: sudo apt-get install qt4- ...

  3. ubuntu 15 安装Qt

    Linux 下安装 QT5.4.0      http://blog.163.com/xd8171@126/blog/static/620810432015027111314471/ Linux qt ...

  4. Ubuntu下安装QT

    环境 Ubuntu 9.10 qt4.7.3 gcc 4.4 Ubuntu中缺少 make 首先安装  sudo apt-get install make 如果不知道缺少啥,就按下面的装 1.sudo ...

  5. 在Ubuntu下安装qt

    安装qt前的准备: 安装基础开发包,主要gcc,g++等: sudo apt-get install build-essential 1. 使用qt-opensource-linux-x86-5.5. ...

  6. (原)ubuntu上安装qt

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/5652429.html 参考网址: http://doc.qt.io/qt-4.8/install-x1 ...

  7. Ubuntu 下安装 Qt Designer

    1. apt-get install qt5-designer 2.终端下输入designer,显示: designer: could not exec '/usr/lib/x86_64-linux- ...

  8. 在Ubuntu 内安装spin

    相关课程:协议分析与设计 虽然一些镜像仓库内提供了spin,并且可以直接使用apt 或者yum 安装,但其版本总不是最新的,而且无法使用ispin 图形界面.因此本文介绍了手动下载编译spin 的步骤 ...

  9. ubuntu下搭建nfs,tftp,安装qt等一些基本的启动bootloader前的服务

    之前做三星的6410是在红帽下做的,现在公司给了个TI的AM3359的开发板,开发环境是ubuntu10-04.这周经过半天的研究对比,终于算是搭好tftp下载的一些服务了. [防火墙] sudo u ...

随机推荐

  1. javap指令

    栈和局部变量操作将常量压入栈的指令aconst_null 将null对象引用压入栈iconst_m1 将int类型常量-1压入栈iconst_0 将int类型常量0压入栈iconst_1 将int类型 ...

  2. 当页面是动态时 如果后台存储id可以通过查询后台方式获取对象;当后台没有存储时候 只有通过前端标记了 例如标记数量为10 我们根据传递过来的10循环取值

    当页面是动态时 如果后台存储id可以通过查询后台方式获取对象;当后台没有存储时候 只有通过前端标记了 例如标记数量为10 我们根据传递过来的10循环取值

  3. hdu-4763(kmp+拓展kmp)

    题意:给你一个串,问你满足最大字串既是前后缀,也在字符串除去前后缀的位置中出现过: 思路:我用的是拓展kmp求的前后缀,只用kmp也能解,在字符串2/3的位置后开始遍历,如果用一个maxx保存前2/3 ...

  4. Modeling Filters and Whitening Filters

    Colored and White Process White Process White Process,又称为White Noise(白噪声),其中white来源于白光,寓意着PSD的平坦分布,w ...

  5. Hibernate中的Entity类之间的继承关系之一MappedSuperclass

    在hibernate中,Entity类可以继承Entity类或非Entity类.但是,关系数据库表之间不存在继承的关系.那么在Entity类之间的继承关系,在数据库表中如何表示呢? Hibernate ...

  6. MySql获取树型结构的所有子节点

    stackoverflow的解决方案,亲测有效: SELECT * FROM person WHERE department IN (SELECT department_id FROM departm ...

  7. Treasure Hunting HDU - 3468

    题意: 输入一个n行m列的图 每次按字母顺序走最短路, 从一个字母走到下一个字母的过程中,只能拿走一个金子,求走完当前图中所有的字母后能拿到的金子的最大值 解析: bfs求最短路 对于一个金子如果 d ...

  8. 【XSY2767】朋友 广义后缀自动机 网络流

    题目描述 懒得写了...直接贴题面 $\sum n\leq5000,1\leq S_{i,j}\leq k\leq 1000 $ 题解 先建出广义sam. 可以发现朋友的出现位置的定义符合后缀自动机的 ...

  9. Centos 7.3 安装Grafana 6.0

    grafana简介 Grafana是一个完全开源的度量分析与可视化平台,可对来自各种各种数据源的数据进行查询.分析.可视化处理以及配置告警. Grafana支持的数据源: 官方:Graphite,In ...

  10. html块、含样式的标签

    html块 1.div标签 块元素,表示一块内容,没有具体的语义. 2.span标签 行内元素,表示一行中的一小段内容,没有具体的语义. 含样式和语义的标签 1.em标签 行内元素,表示语气中的强调词 ...