"Gtk-WARNING **: cannot open display: " when using execve to launch a Gtk program on ubuntu
Posted
by michael
on Stack Overflow
See other posts from Stack Overflow
or by michael
Published on 2010-03-13T09:06:25Z
Indexed on
2010/03/13
9:15 UTC
Read the original article
Hit count: 865
Hi,
I have the following c program which launches a Gtk Program on ubuntu:
#include <unistd.h>
int main( int argc, const char* argv[] )
{
char *args[2] = { "testarg", 0 };
char *envp[1] = { 0 };
execve("/home/michael/MyGtkApp",args,envp);
}
I get "Gtk-WARNING **: cannot open display: " and my program is not launched.
I have tried setting char *envp[1] = {"DISPLAY:0.0"}; and execute 'xhost +' , I dont' see the 'cannot open display' warning, but my program is still not launched.
Does anyone know how to fix my problem?
Thank you.
© Stack Overflow or respective owner