Tuesday, November 24, 2009

Simple Tutorial on Compiling C programs with GCC

GCC is the GNU c compiler that can does a lot of heavy lifting in the programming worlds.

The basic format for compiling a Hello World program is:

gcc hello.c -o hello

In this statement 'hello.c' is the program, '-o' is an option and 'hello' will be the name of the executable program. The '-o' option just specifies that compiled version of your program will be saved to an another filed called 'hello'. If you exclude this option, the the compiler will save to a default 'a.out' file.