kylin v10 qt程序被第三方程序启动,报错:no protocol specified qt.qpa.xcb:could not connect to display :0.0

2 篇文章 0 订阅
2 篇文章 0 订阅

在Kylin v10上编写了一个c++程序A, 这个程序是监听了linux底层的事件,只要用户操作触发了这类型的事件,就会启动程序A, 在程序A中满足条件时,又会启动另外一个qt开发的客户端程序,本机系统kylin v10 arm64。

实际情况是用户操作出发了事件后, 启动A, A启动B, 但是B启动不了,查看/tmp/log.txt, 查看到程序B的报错信息如上, 然而在本机系统上单独启动B , B程序正常启动。

 只好google之, 根据以下的信息, 解决了自己的问题,各人的实际情况不同,我是在程序B的启动脚本中引入了export XAUTHORITY=本机.Xauthority的路径    ,解决了我的问题。

  

Accessing the X server requires two things:

  • The $DISPLAY variable pointing to the correct display (usually :0)
  • Proper authentication information

The authentication information can be explicitly specified via $XAUTHORITY, and defaults to ~/.Xauthority otherwise.

If $DISPLAY and $XAUTHORITY is set for your user, sudo will set them for the new shell, too, and everything should work fine.

If they are not set, they will probably default to the wrong values and you cannot start and X applications.

In Debian $XAUTHORITY is usually not set explicitly. Just add

export XAUTHORITY=~/.Xauthority

to your .bashrc or explicitly say XAUTHORITY=~/.Xauthority sudo ... and everything should work.

You can also use xauth list to check whether proper authentication information are available。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值