ubuntu20.04 与Qt5.15.2 安装问题

目录

      • [1] qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
      • 解决:

[1] qt.qpa.plugin: Could not load the Qt platform plugin “xcb” in “” even though it was found.

这是由于缺少库造成的
1 打开QT插件调试:
命令行输入:export QT_DEBUG_PLUGINS=1
或者在 ~/.bashrc 中添加 export QT_DEBUG_PLUGINS=1
2 切换到qtcreater 安装目录

cd (qt安装目录)/Tools/QtCreator/bin 
./qtcreater

看到打印:ibqxcb.so: (libxcb-xinerama.so.0: 无法打开共享对象文件: 没有那个文件或目录)

Got keys from plugin meta data ("xcb")
QFactoryLoader::QFactoryLoader() checking directory path "/media/wmx/res/wmx-software/Qt/Tools/QtCreator/bin/platforms" ...
Cannot load library /media/wmx/res/wmx-software/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: 无法打开共享对象文件: 没有那个文件或目录)
QLibraryPrivate::loadPlugin failed on "/media/wmx/res/wmx-software/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so" : "Cannot load library /media/wmx/res/wmx-software/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/libqxcb.so: (libxcb-xinerama.so.0: 无法打开共享对象文件: 没有那个文件或目录)"
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, xcb.

说明缺少 xcb-xinerama 库
切换到平台插件目录:
cd (Qt安装目录)/Tools/QtCreator/lib/Qt/plugins/platforms
输入以下命令
ldd libqxcb.so |grep not

/media/wmx/res/wmx-software/Qt/Tools/QtCreator/lib/Qt/plugins/platforms$ ldd libqxcb.so  |grep not 
	libxcb-xinerama.so.0 => not found
	libxcb-xinerama.so.0 => not found

说明只缺少xcb-xinerama 库,如果还缺少其它库,安装它们

解决:

sudo apt-get install libxcb-xinerama0

然后切换到qtcreater目录,运行:

cd /Qt安装目录/Tools/QtCreator/bin$
./qtcreator

运行成功

你可能感兴趣的:(QT/QML)