I have made a small Snake game using C. When I open it via GUI (Nemo), nothing gets opened. But if I open it using the terminal, it works as expected. I've tried it on multiple computers with different OSes (Ubuntu, Mint etc) but all exhibit the same problem.
I also tried right clicking the file, selecting 'Open with other application' and typing the following in the 'Enter custom command to execute' textbox:
gnome-terminal --working-directory ~/Downloads/My\ Programs/Snake -e "/bin/bash -c './Snake && read'"
and then tried opening the executable. Still, nothing happens.
But executing the same command using the terminal works perfectly. Permissions set for the Snake
executable file are -rwxr-xr-x
and its type is Program (application/x-executable)
. Also, file
gives:
$ file Snake
Snake: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=c609e53bda05544c647aab2a19aa865af6dc93c2, not stripped
What could be the problem?
env -i DISPLAY=$DISPLAY ./Snake
work in the terminal? – Gilles 'SO- stop being evil' Dec 26 '16 at 22:24int main(void) { puts("TEST"); getchar(); }`.
This program's executable also exhibits the same problem as the Snake game, i.e, runs from the terminal, but not via GUI.
– Spikatrix Dec 27 '16 at 04:31env -i DISPLAY=$DISPLAY ./Snake
does work but prints someTERM environment variable not set
probably because I've used system calls such assystem("clear");
in my program. To simplify things, I've made another programtest
(See comment above) and runningenv -i DISPLAY=$DISPLAY ./test
from the terminal works as usual. – Spikatrix Dec 27 '16 at 04:40