LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how to run compiled C file. (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-run-compiled-c-file-226907/)

cdmn 09-05-2004 07:17 AM

how to run compiled C file.
 
Hi there.

im very very noob at linux/unix and all shell stuff.
I just bought a shell accout to study C programming (-:
I wrote 'hello world' example.
Compiled it like so: gcc test.c
I got a.out (dont know what it is)

And my question would be: how to run it ? (-:
I just wanna see 'Hello world' ... :/

scuzzman 09-05-2004 07:23 AM

the a.out is the executable
simply type
Code:

./a.out
to compile it with an executable called helloworld, you'd do this:
Code:

gcc -o helloworld helloworld.c
gcc - call the compiler
-o - the next argument is the Object file (the executable)
helloworld - the object for reasons stated above
helloworld.c - the source

bijay 09-05-2004 07:24 AM

Hi,

If your working directory is the same where the a.out file is, then enter the following at command prompt.


./a.out


All times are GMT -5. The time now is 03:11 PM.