LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   run c-files (https://www.linuxquestions.org/questions/linux-newbie-8/run-c-files-791505/)

kickarzt 02-25-2010 09:19 AM

run c-files
 
This is not working for me, I cant run my c-code files.
this is how I do:

gcc fileName.c
./fileName.c

but I cant get it to run!

I have gcc installed. Whats wrong?

I only get, no such file or...

Do I have so save the file somewhere special?

ordinary 02-25-2010 09:38 AM

First, try "man gcc". Man is your friend.

Second, I believe that gcc leaves its executable output in a file called a.out by default. To produce a different file, use the -o option. For instance, try "gcc foo.c -o foo". That will compile a file "foo.c" and produce an executable "foo". To execute, try "./foo". Of course, use your own filenames rather than "foo".


gcc has many interesting options. Check gcc manuals, particularly man and info.

Phil


All times are GMT -5. The time now is 02:52 AM.