Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » 7. Operating System » GCC

GCC

gcc filename.c

GNU C compiler. Quite straight-forward if you know C. Extensive free manuals are available on the net.

How do I compile a simple C program?

Start your favourite text editor and type in your source code. For example, I may use pico:
pico hello.c

and type in the Kerningham and Richie (the creators of “c”) intro example of a C program:

#include <stdio.h>
void main(void) {
printf("hello world\n");
}

I save the file and then invoke the GNU C compiler to compile the file “hello.c”:
gcc hello.c

The gcc compiler produces an executable binary file “a.out”, which I can run:
./a.out

Filed under: 7. Operating System

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>