项目场景:
Ubuntu20.04安装Qt,创建项目,编译运行
根据需要下载适合版本的Qt在线安装器: 清华大学镜像库





问题描述
Qt安装器无法双击启动
解决方案:
修改文件属性:

问题描述
qt安装后新建项目,却无法编译项目:

原因分析:
缺少C++环境:

解决方案:
安装C++环境:
sudo apt-get install g++
问题描述
安装C++环境后进行编译,有报错:
12:29:17: Could not start process “make” -f /home/linasi/build-untitled-Desktop_Qt_5_15_2_GCC_64bit-Debug/Makefile qmake_all.
Error while building/deploying project untitled (kit: Desktop Qt 5.15.2 GCC 64bit)
When executing step “qmake”
解决办法:
sudo apt-get install build-essential
问题描述
/usr/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make: *** [Makefile:282: untitled] Error 1
12:36:26: 进程"/usr/bin/make"退出,退出代码 2 。
Error while building/deploying project untitled (kit: Desktop Qt 5.15.2 GCC 64bit)
When executing step “Make”
解决办法:
sudo apt-get install libgl1-mesa-dev
问题描述
qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
解决办法:
sudo apt-get install libxcb-xinerama0
成功编译运行:

本文详细记录了在Ubuntu 20.04环境中安装Qt并创建项目过程中遇到的问题,包括安装器无法启动、缺少C++环境导致编译错误,以及如何通过`apt-get`安装相关包解决`GL`链接问题、Qtplatformplugin缺失等。最后成功实现编译并运行项目。
3859

被折叠的 条评论
为什么被折叠?



