make an executable file in linux

Dec 12, 2010 at 8:18am
Hey all!

When i compile something on a windows pc with lets say dev-c++ or code::blocks, i always get a simple .exe file which can be opened with a simple double click. On linux (i am using ubuntu) when i compile something with code::blocks i get a file without an extention, but the icon shows that the program is executable. When you double click it, nothing happens. When you give it permissions (allow executing this file as a program) it still doesn't do anything. if you add a command for opening it with Autorun Prompt (which was a wild guess 'cause i thought it would work) it also doesn't do anything, so what the hell? How can i make an executable file in linux that works with a simple double click?
Dec 12, 2010 at 8:55am
How do you know it's not executed?
Check the running processes and you'll see that it runs (unless the program exits immediately).
Dec 12, 2010 at 9:33am
it doesn't, it is a simple hello world app, and it has a cin.ignore() at the end.
Dec 12, 2010 at 10:22am
Why don't you run it from the IDE?

If you open a terminal and run /yourpath/yourexecutablefile it should run
( If you are already in the directory of the executable file run it like this: ./yourexecutablefile
Dec 12, 2010 at 10:30am
i DO run it from the IDE, but i want to be able to open it using a simple double click, is that possible?
Dec 12, 2010 at 10:46am
You can change the file association to xterm -e
Dec 12, 2010 at 10:48am
where do i change it?
Dec 12, 2010 at 10:51am
Is it a console program? If so, do you expect a terminal to appear? Because that won't happen if you run an executable from a file browser. It will run, but all output will usually be written to the .xsession-errors file.
However, you can create a shell script that runs e.g. gnome-terminal with your program as a parameter. Or just start it from a terminal, which is what you should've done in the first place.
Dec 13, 2010 at 3:33pm
so no way to make it into a single file?
Dec 13, 2010 at 3:37pm
The binary the compiler/linker produces is a single file.
Dec 13, 2010 at 4:54pm
i mean one that works with a simple doubleclick, no shell script or running through the terminal
Dec 13, 2010 at 5:03pm
It "works". If you run it from the file browser, the program will run. If it is a GUI program and creates a window, you'll see the window. If it doesn't, you won't.
If you care about the output or if it expects input, you run it from the terminal.
It's as simple as that.
Topic archived. No new replies allowed.