无法使用 Qt 应用程序连接到 X 服务器:0.0 [英] Cannot connect to X server :0.0 with a Qt application
问题描述
在 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
感谢您的建议,
推荐答案
一般原因如下:
DISPLAY 未在环境中设置.
解决方案:
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屋!