PDA

View Full Version : GCC compiled programs won't run



bobti
29th October 2006, 05:54 PM
Hi,

I have written a simple program in C using gedit.
I compiled it using GCC successfully and it creates a binary.
If I try to run the binary in a terminal I get nothing i.e. its like the program just starts and instantly ends.

Here is my simple code.

#include <stdio.h> ;

int main ( void ) {
printf ("Hello\n") ;
return 0 ;
}

I'm using FC5 that has just been fresh installed.
Any ideas??

LLS
29th October 2006, 07:12 PM
do you use
./"binary_name"to run it?

bobti
30th October 2006, 04:32 PM
do you use
./"binary_name"to run it?

Thanks, that worked. I was just typing in the binary name and hitting enter like I have been doing on Red Hat for weeks!
Do you know why Fedora is different?

Thanks

William Haller
30th October 2006, 04:46 PM
The current working directory isn't included in the path. Type
PATH=$PATH:.
to add it to the search path if you want to. You can also modify the $PATH environment variable in your .bashrc file.