QtCreator installation and compilation environment configuration under ubuntu

1. Download the version of qt creator that needs to be installed,

What I downloaded is: version 5.12, URL: download.qt.io/archive/qt/5.12/5.12.0/

2. Start the installation

Switch to the Dwownloads directory and enter the installation command: sudo ./qt-opensource-linux-x64-5.12.0.run

But it will prompt that the command cannot be found, re-enter:

chmod a+x qt-opensource-linux-x64-5.12.0.run

./qt-opensource-linux-x64-5.12.0.run

At this time, the execution is successful, and the installation dialog box interface pops up.

It is best to disconnect the network and install at this time.

3. After the installation is complete, it needs to be configured to install GCC before it can be used normally. This article uses qtchooser to configure.

tsh@tsh-ThinkPad-T460p:~$ sudo apt install qtchooser
[sudo] tsh 的密码: 
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
下列【新】软件包将被安装:
  qtchooser
升级了 0 个软件包,新安装了 1 个软件包,要卸载 0 个软件包,有 671 个软件包未被升级。
需要下载 24.1 kB 的归档。
解压缩后会消耗 125 kB 的额外空间。
获取:1 http://cn.archive.ubuntu.com/ubuntu bionic/main amd64 qtchooser amd64 64-ga1b6736-5 [24.1 kB]
已下载 24.1 kB,耗时 5秒 (4,478 B/s) 
正在选中未选择的软件包 qtchooser。
(正在读取数据库 ... 系统当前共安装有 127475 个文件和目录。)
正准备解包 .../qtchooser_64-ga1b6736-5_amd64.deb  ...
正在解包 qtchooser (64-ga1b6736-5) ...
正在设置 qtchooser (64-ga1b6736-5) ...
正在处理用于 man-db (2.8.3-2) 的触发器 ...
tsh@tsh-ThinkPad-T460p:~$ qtchooser -l
4
5
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5
tsh@tsh-ThinkPad-T460p:~$ sudo qtchooser -install qt5.12 /opt/Qt5.12.0/5.12.0/gcc_64/bin/qmake
tsh@tsh-ThinkPad-T460p:~$ export QT_SELECT=qt5.12
tsh@tsh-ThinkPad-T460p:~$ qtchooser -l
4
5
qt4-x86_64-linux-gnu
qt4
qt5-x86_64-linux-gnu
qt5.12
qt5
tsh@tsh-ThinkPad-T460p:~$ 
tsh@tsh-ThinkPad-T460p:~$ qmake -v
QMake version 3.1
Using Qt version 5.12.0 in /opt/Qt5.12.0/5.12.0/gcc_64/lib
tsh@tsh-ThinkPad-T460p:~$ 

Install the compiler g++: sudo apt-get install build-essential (a long time)
 

tsh@tsh-ThinkPad-T460p:~$ sudo apt-get install build-essential
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会同时安装下列软件:
  cpp cpp-7 dpkg-dev fakeroot g++ g++-7 gcc gcc-7 gcc-7-base gcc-8-base libalgorithm-diff-perl
  libalgorithm-diff-xs-perl libalgorithm-merge-perl libasan4 libatomic1 libc-dev-bin libc6
  libc6-dbg libc6-dev libcc1-0 libcilkrts5 libdpkg-perl libfakeroot libgcc-7-dev libgcc1
  libgomp1 libitm1 liblsan0 libmpx2 libquadmath0 libstdc++-7-dev libstdc++6 libtsan0 libubsan0
  linux-libc-dev make manpages-dev
建议安装:
  cpp-doc gcc-7-locales debian-keyring g++-multilib g++-7-multilib gcc-7-doc libstdc++6-7-dbg
  gcc-multilib autoconf automake libtool flex bison gcc-doc gcc-7-multilib libgcc1-dbg
  libgomp1-dbg libitm1-dbg libatomic1-dbg libasan4-dbg liblsan0-dbg libtsan0-dbg libubsan0-dbg
  libcilkrts5-dbg libmpx2-dbg libquadmath0-dbg glibc-doc git bzr libstdc++-7-doc make-doc

 Note: If it appears:

E: There are several software packages that cannot be downloaded. How about running apt-get update or adding --fix-missing option and try again? Just execute the following command.

sudo apt-get update
sudo apt-get install --fix-missing

Install the general font configuration library: sudo apt-get install libfontconfig1

tsh@tsh-ThinkPad-T460p:~$ sudo apt-get install libfontconfig1
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
libfontconfig1 已经是最新版 (2.12.6-0ubuntu2)。
升级了 0 个软件包,新安装了 0 个软件包,要卸载 0 个软件包,有 675 个软件包未被升级。

Open qtcreator, Tools -> Options ->, select the compiler.

 sudo apt-get install build-essential

sudo apt-get install libgl1-mesa-dev

Install the OpenGL library:

sudo apt-get install mesa-common-dev

    For new versions of Ubuntu systems, additional packages need to be installed:

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

So far, you can successfully compile~

If it still doesn't work, execute the following command in the terminal:

 sudo apt-get install build-essential

sudo apt-get install libgl1-mesa-dev

 

Guess you like

Origin blog.csdn.net/weixin_41882459/article/details/111060429