无法使用Qt应用程序连接到X服务器:0.0 [英] Cannot connect to X server :0.0 with a Qt application

查看:480
本文介绍了无法使用Qt应用程序连接到X服务器:0.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Fedora 10上编译.

Compiling on Fedora 10.

我刚刚启动了我的第一个qt GUI应用程序.我使用了所有默认设置.

I have just started my first qt GUI application. I used all the default settings.

它只是一个简单的形式.它构建良好,没有任何错误.但是当我尝试运行该应用程序时.我收到以下消息:

Its just a simple form. It builds OK without any errors. But when I try and run the application. I get the following message:

Starting /home/rob/projects/qt/test1/test1/test1...
No protocol specified
test1: cannot connect to X server :0.0

谢谢您的建议,

推荐答案

造成这种情况的一般原因如下:

The general causes for this are as follows:

  1. 未在环境中设置DISPLAY.
    解决方案:

  1. DISPLAY not set in the environment.
    Solution:

export DISPLAY=:0.0
./myQtCmdHere

(虽然这似乎不是错误的,因为它说X试图连接到它.而且,它并不总是0.0,但大多数时候是)

( This one doesn't appear to be the one at fault though, as its saying which X display its trying to connect to. Also, its not always 0.0, but most of the time it is )

非授权用户试图运行X应用程序
解决方案(作为X拥有用户,即:您自己)

Non-Authorised User trying to run the X Application
Solution ( as X owning user, ie: yourself )

xhost +local:root   # where root is the local user you want to grant access to. 

这篇关于无法使用Qt应用程序连接到X服务器:0.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆