Linux下安装Qt6的问题及解决

  1. Linux下安装完Qt6,新建Qt/QtQuick CMake工程编译出现如下错误:
Found package configuration file: Qt6Config.cmake but it set Qt6 FOUND to FALSE so package "Qt6" is considered to be NOT FOUND. Reason given by package: Failed to find required Qt componen "Quick".

这是因为系统中缺少OpenGL库,可以安装libgl1-mesa-dev

sudo apt install libgl1-mesa-dev

如果出现E: Package 'libgl1-mesa-dev' has no installation candidate,可以添加 main repository到apt,执行update后再安装。

sudo add-apt-repository main
sudo apt update
  1. 项目编译成功后运行,如果出现如下错误
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even through it was found.
Available platform plugins are: eglfs, wayland-egl, vkkhrdisplay, linuxfb, minimal, xcb, offscreen, minimalegl, vnc.

可以通过安装 libxcb 解决: sudo apt install libxcb-cursor*

posted @ 2023-10-26 23:38  jigsawecho  阅读(775)  评论(0编辑  收藏  举报