富贵资源网 Design By www.hznty.com

问题描述

安装Qt5.15.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.

Aborted (core dumped)

根据问题描述,虽然能够找到但是不能加载Qt平台插件“xcb”,虽然接下来又说重新安装可能能够解决,这个可能的话,还是尽量作为最下的选择吧。

定位问题

修改配置文件~/.bashrc:

$ vim ~/.bashrc

在最末尾添加如下语句,会在qtcreator启动时,列出详细的错误提示。

export QT_DEBUG_PLUGINS=1

如下:

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

保存退出编辑,使配置文件生效:

$ source ~/.bashrc

启动qtcreator会弹出如下详细错误信息:

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

在打印的错误信息的最下面,找到了引发错误的真正原因:

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

也就是Qt动态链接库的问题,当加载libqxcb.so库的时候,还需要加载libxcb-xinerama库。
切换到报错libxcb.so所在目录:

#替换为自己的报错目录
$ cd /home/brainiac/Qt/Tools/QtCreator/lib/Qt/plugins/platforms/

运行ldd libqxcb.so,查看关联内容:

$ ldd libqxcb.so

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

发现不存在libxcb-xinerama.so.0库。

解决方法

安装libxcb-xinerama库:

#如果还存在其他依赖库没有安装,也一并安装。
$ sudo apt-get install libxcb-xinerama0

安装完成后,再次查看关联内容,发现已经修复问题:

$ ldd libqxcb.so

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

再次运行qt程序,就可以正常运行了。

Ubuntu18.04下解决Qt出现qt.qpa.plugin:Could not load the Qt platform plugin “xcb“问题

后记

又可以愉快的coding了。

总结

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。