"Gtk-WARNING **: cannot open display: " when using execve to launch a Gtk program on ubuntu
- by michael
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.