PDA

View Full Version : [SOLVED] Any way to double-click C programs to run?



gavin_attoe
November 13th, 2011, 08:47 PM
I've been doing quite a bit of C programming lately, and was wondering if there was a way to make the program files able to execute with a double click. I have been using "./" to run everything in the terminal window thus far. Like is there any way to just compile it so it would have that ability like .exes do in Micro$oft OSs?

Any suggestions appreciated. :)

t1497f35
November 13th, 2011, 09:02 PM
It's unclear what you mean since C programs if compiled properly do execute at double click on any OS including Linux.

suspect x
November 13th, 2011, 09:31 PM
You Can Try to use IDE tools such as ECLIPS and many others available for free

cgroza
November 13th, 2011, 10:49 PM
I think you will need to create a launcher for your executable.
But really, using a text editor such as Geany will make it a lot easier.

jwbrase
November 13th, 2011, 11:51 PM
It's unclear what you mean since C programs if compiled properly do execute at double click on any OS including Linux.

I think what he's running into is that Linux DE's generally don't automatically open a terminal for programs that interact via the command line. So his program is running, but he's not seeing any evidence of it.

A kludgy fix (I'm not aware of a better one), would be to write a shell script named InsertProgramNameHere.sh that would call the program:


#/bin/bash
exec InsertProgramNameHere

Then, by double clicking on the shell script, he could get the Run/View dialog that you get for shell scripts (on GNOME at least), which has an option "Run in Terminal".

gavin_attoe
November 15th, 2011, 05:08 AM
It's unclear what you mean since C programs if compiled properly do execute at double click on any OS including Linux.

Actually I'm not seeing any evidence of my command line programs running when double-clicked, even those that take user input when run with "./"



You Can Try to use IDE tools such as ECLIPS and many others available for free


I think you will need to create a launcher for your executable.
But really, using a text editor such as Geany will make it a lot easier.

I haven't tried compiling with an IDE such as Eclipse or Geany yet. I'll give that a shot. I've just been using gedit so far.


Then, by double clicking on the shell script, he could get the Run/View dialog that you get for shell scripts (on GNOME at least), which has an option "Run in Terminal".

I was really hoping to avoid shell scripts, but you're right; they do work. You can actually just type scripts into a text file without the ".sh" extension, then use properties to make them execute in the terminal, as you said.

BTW I'm using Ubuntu 10.04 Lucid Lynx. I didn't want to risk an upgrade, but did pick up some Natty Narwhal desktop backgrounds for it :D


Edit: I'm going with the IDE Geany that cgroza suggested. It's very lightweight as opposed to Eclipse, and has the ability to run programs after compiling with some quick key shortcuts. The built/compiled program still doesn't open on double click, but if I design a large program that I really need that for I'll go with either a launcher, or shell script like jwbrase suggested. Thank you all for submitting answers.