ubuntu安装QT5
来源:互联网 发布:交大 汉芯 知乎 编辑:程序博客网 时间:2024/06/14 01:32
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 also for newer versions of Qt and Ubuntu. A difference for OpenGL has been found and added as a note below.
Installation Guide
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
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.
Introduction
This is a tutorial for installation of Qt 5.7.0 to Ubuntu 12.10. It may be used also for newer versions of Qt and Ubuntu. A difference for OpenGL has been found and added as a note below.
Installation Guide
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
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.
阅读全文
0 0
- Ubuntu上安装Qt5
- ubuntu安装Qt5
- ubuntu 12.04 安装Qt5
- Ubuntu QT5.5.0 安装
- Ubuntu安装ss-qt5
- ubuntu安装QT5.7
- ubuntu安装QT5
- ubuntu编译安装qt5.0.1
- ubuntu 12.04 安装QT5.1
- ubuntu下安装qt5.1
- ubuntu kylin14.04 安装qt5
- ubuntu 安装配置shadowsocks-qt5
- Ubuntu 15.10 安装Qt5.5.1
- Ubuntu下安装Shadowsocks-qt5
- ubuntu下安装QT5.7.1
- Ubuntu 16.04 Qt5安装qtcharts
- Ubuntu下安装Qt5.8
- ubuntu下安装QT5及QtCreator
- Android-ANR-Android App优化之ANR详解
- Thunderhead Engineering PetraSim 2017.1.0209 x86\
- 全世界都在关注中国企业的互联网架构?云栖大会道出了真相
- 微服务:史上最简单的 SpringCloud 教程 | 终章
- BTree和B+Tree详解
- ubuntu安装QT5
- 正则表达式工具RegexBuddy使用教程
- 临时笔记:豪大推荐的Vue 学习路径(二)
- IO流的基础
- Spring框架第二天(IOC和AOP)
- 对持久层sql语句的高复用性的一点小领悟
- Socket通讯
- 运算符的优先级原则
- 第二届全国智能制造(中国制造2025) 创新创业大赛华东赛区在苏州启动