GCC (acronym for GNU Compiler Collection) is a compiler system produced by the GNU Project supporting various programming languages like C, C++, Objective-C, Fortran, Java, Ada, and Go.GCC is a key component in the collection of programming tools produced by the GNU Project.And the official compiler for the GNU/Linux Operating System .
Now Let us create our first C program on Linux
The things required for creating C programs are
- A Text Editor – like gedit
- Compiler – GCC
- C Standard Library – GNU C Library known as glibc
The Text Editor am using is gedit ..you can use any one of your choice ..
The compiler being used is the standard compiler for the GNU Operating System -GCC .
Its necessary to see if GCC has been installed or not so issue the command
now if u get a message as “GCC : no input files” this indicates that the GCC is installed and ready to use.
The GNU C Library commonly known as glibc is the C standard library released by the GNU Project.
The locate command can be used to confirm that glibc is already installed on the system as follows:
$ locate glibc
if its on the system it will show where its present ..
Now lets come to the actual programming part
>> Writing The Program
lets write a small piece of code using some text editor
i have named the file as hello.c
>> Compiling The Program
The program can be compiled using GCC by using the following command
gcc -o hello hello.c
The -o option informs the compiler of the desired name for the executable file that it produces.If there are any errors in the program the compiler will show an error message ..
>> Running The Program
Running the program is done in classic Linux style by using the Dot-slash command (./)
The result will be displayed on the screen …
This is a “Hello World” Tutorial on C Programming on GNU/Linux Using GCC !!
The official GCC page is available here