What is gcc Compiler ?
GCC is an integrated compiler of the GNU project for C, C ++, Objective C and FORTRAN; It is able to receive a source program in any of these languages and generate a binary executable program in the language of the machine where it is to run.
The acronym GCC stands for “GNU Compiler Collection”. Originally it meant “GNU C Compiler”; GCC is still used to designate a compilation in C. G ++ refers to a compilation in C ++.
Syntax.
gcc -[option] [file] ...g++ -[option] [file] ...
The options are preceded by a script, as usual in UNIX, but the options themselves can have several letters; Multiple options cannot be grouped after the same script. Some options then require a file or directory name, others do not. Finally, several file names can be given to include in the compilation process.
Examples
Compile the program in C main.c, generate an executable file a.out
:~$ gcc main.c
Compile the program in C main.c, generate an executable file cisfun.
:~$ gcc -o cisfun main.c
It does not generate the executable, but the object code, in the file holberton.o. If a name is not indicated for the object file, use the name of the file in C and change the extension to .o.
:~$ gcc -c holberton.c
generates the object code indicating the file name.
:~$ gcc -c -o object.o hello.c
If you want to know more about using gcc RTFM, or visit http://man7.org/linux/man-pages/man1/gcc.1.html#top_of_page
:~$ man gcc
Stages of compilation
The compilation process involves four successive stages: preprocessing, compilation, assembly and linking. To pass from a source program written by a human to an executable file, it is necessary to perform these four stages in succession. The gcc command can perform the entire process at once.
The figure above shows the basic scheme of the process of compiling programs, modules and creating libraries in C. In this graph, we indicate by means of a rectangle with rounded corners the different programs involved in these tasks, while the cylinders indicate the types of files (with their usual extension) that intervene.