[Part 1] Ubuntu 16.04安装和配置QT5 | Part-1: Install and Configure Qt5 on Ubuntu 16.04

本文详细介绍了如何在Ubuntu 16.04上安装和配置QT5,包括卸载旧版QT,安装QT5.7及其依赖,设置环境变量,配置qtchooser,以及使用QT Creator创建应用程序和实现Qt槽功能的方法。
摘要由CSDN通过智能技术生成

本文首发于个人博客https://kezunlin.me/post/91842b71/,欢迎阅读!

Part-1: Install and Configure Qt5 on Ubuntu 16.04

Series

Guide

  • qt: 5.7.0
  • qmake: 3.0 based on Qt 5.7.0
  • qtcreator: 3.5.1 based on Qt 5.5.1

purge existing qt5 and qt4

    sudo apt-get purge qt5-default qtcreator 
    sudo apt-get purge qt4-designer qt4-dev-tools

install qt57

In addition, building graphical Qt applications requires OpenGL libraries and headers installed. On Ubuntu and other Debian-based Linux systems you can get OpenGL and the minimal set of development tools by installing the packages libgl1-mesa-dev and build-essential, i.e. by running this command:

    sudo apt-get install build-essential libgl1-mesa-dev

Download qt and install.

    sudo apt-get install build-essential libgl1-mesa-dev
    wget http://download.qt.io/official_releases/qt/5.7/5.7.0/qt-opensource-linux-x64-5.7.0.run
    chmod  x qt-opensource-linux-x64-5.7.0.run
    ./qt-opensource-linux-x64-5.7.0.run

install to /opt/Qt5.7.0

    cd /opt
    sudo ln -s /opt/Qt5.7.0 qt

add qt bin to path

    vim .bashrc
    # added by kzl
    export PATH=/opt/cuda-8.0/bin:$PATH
    export PATH=/opt/MATLAB/R2016b/bin:$PATH
    export PATH=/opt/qt/5.7/gcc_64/bin:$PATH

qt.conf for ld.so.conf.d

    cd /etc/ld.so.conf.d
    sudo vim qt.conf
    /opt/qt/5.7/gcc_64/lib
    sudo ldconfig

or only install qtcreator (find_package error for `qt5x11extra-config.cmake`)

    sudo apt-get install qt5-default qtcreator
    sudo apt-get install q
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值