“Gtk-WARNING **: cannot open display:” when running a gtkmm project in Eclipse

↘锁芯ラ 提交于 2019-12-30 11:04:33

问题


I'm trying to run a gtkmm project in Eclipse CDT (On Ubuntu). The project compiles fine, there are no errors reported but when I try to run the project the console prints out this message

"Gtk-WARNING **: cannot open display:"

If I go to where the executable is located, in nautilus, I can open it and it runs fine. It's just a problem when trying to run directly from Eclipse.

Thanks,


回答1:


It sounds like the the "DISPLAY" environment variable is not being set in the environment used by eclipse to launch your application.

To check this, Edit the Run Configuration for the the program you are trying to launch. Next, select the Environment tab. If there is a DISPLAY variable already set, make sure it is correct (usually it should be ":0.0"). If there is not one, create one and set it to ":0.0".



来源:https://stackoverflow.com/questions/5745740/gtk-warning-cannot-open-display-when-running-a-gtkmm-project-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!