Tuesday, May 10, 2011

How to compile your C program in Linux

welcome back to this blog, now i'd like to show yo how we compile our C program in Linux? the answer is just using GCC. what is that GCC? GCC is a compiler listing of the C language program that works on linux platform. This compiler is a leading compiler on linux operating system which is a product of the Free Software Foundation, which is open source and free. Although it is free, the GCC is not the software is cheap because behind kemurahmeriahannya there is the reliability of the GCC can compile programs written in C, C + +, object C, Fortran (with the help of G77), Pascal, Module-3 and other programs (of course with extra library) . In this article will discuss how do I compile the C language into machine language that is recognizable by the computer system logic 0 and 1 (binary) using GCC. In the compilation process listing program will generate an executable file. To get the executable file from the C language program listings can be by forming a file object first and then form the executable file. $ gcc -c file_name.c //build the object $ gcc -o file_name file_name.o //build the executable or you just can directly build the executable file by using $ gcc -o file_name file_name.c now we got our executable file we can run it just by typing: $ ./file_name in our shell.

No comments:

Post a Comment