Ubuntu20.04安装Qt开发环境编译运行程序

项目场景:

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

成功编译运行:

在这里插入图片描述

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值