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

1、问题描述

在ubuntu18.04中第一次安装QT5,运行时报错

qtcreator.sh 
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)

2、原因分析

QtCreator启动时加载xcb插件时失败。

2.1 使能详细打印信息

修改配置文件~/.bashrc:

$ vim ~/.bashrc

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

export QT_DEBUG_PLUGINS=1

生效:$ source ~/.bashrc

你可能感兴趣的:(Qt,qt)