Debian系列-在新的GNOME下无法启动Qt
  XxAHIGK5wVKO 2023年11月02日 35 0


Debian系列-在新的GNOME下无法启动Qt_Debian

Debian系列-在新的GNOME下无法启动Qt

文章目录

  • ​​Debian系列-在新的GNOME下无法启动Qt​​
  • ​​摘要​​
  • ​​启动Qt 报错 No protocol specified​​
  • ​​解决方法​​
  • ​​1 打开一个新的终端​​
  • ​​2 echo $DISPLAY​​
  • ​​3 export DISPLAY​​
  • ​​更新一下​​


关键字:

​Debian​​、

​Qt​​、

​xcb​​、

​No protocol specified​​、

​关键字5​

摘要

之前在公司搬砖的时候,用的虚拟机内存只给了8个G,监测程序编译的时候基本能用满,所以为了节省内从,桌面使用了​​GNOME经典模式​​姑且这么认为可以节省一点内存,但是还是感觉比较卡,所以就申请了为内存扩容,这会内存扩容好以后,直接给了虚拟机16G 的控件,一下子就大了,就像尝试一下 新的GNOME桌面,切到新的桌面后,发现没法启动Qt了。今天就来搞定他。

Debian系列-在新的GNOME下无法启动Qt_qt_02

启动Qt 报错 No protocol specified

在新的GNOME桌面模式下,使用控制台启动Qt报错No protocol specified,

turing@debian:~$ cd /opt/Qt/Tools/QtCreator/bin/ turing@debian:/opt/Qt/Tools/QtCreator/bin$ ls qbs qbs-config-ui qbs-setup-android qbs-setup-toolchains qtcreator qtcreator.sh qbs-config qbs-create-project qbs-setup-qt qt.conf qtcreator.debug turing@debian:/opt/Qt/Tools/QtCreator/bin$ sudo ./qtcreator [sudo] turing 的密码: No protocol specified qt.qpa.xcb: could not connect to display :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, vkkhrdisplay, vnc, wayland-egl, wayland, xcb. 已放弃

如下图所示

Debian系列-在新的GNOME下无法启动Qt_qt_03

解决方法

这种坑肯定不值我一个人踩过,肯定有大佬能搞定,所以借助万能的谷歌,终于找到了答案(0)​​.

1 打开一个新的终端

在终端中执行以下命令

xhost +

显示如下内容,表示执行正确

access control disabled, clients can connect from any host

2 echo $DISPLAY

在终端中输入​​echo $DISPLAY​​指令

显示多少就是多少,记住这个值,后面要用如下

:0

3 export DISPLAY

在中终端中输入​​export DISPLAY=:0​​​后面的​​:0​​就是我们上面输出的值

这样就完成了,再启动Qt 就可以运行了。

turing@debian:~$ xhost +
access control disabled, clients can connect from any host
turing@debian:~$ echo $DISPLAY
:0
turing@debian:~$ export DISPLAY=:0
turing@debian:~$

Debian系列-在新的GNOME下无法启动Qt_xcb_04

更新一下

这个方法虽然可以解决,但是不是一劳永逸,每次重启系统好像得再来一遍。至少我这里测试是这样。




【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
XxAHIGK5wVKO