compilation with GCC

Juan jose arteta
2 min readFeb 4, 2021

--

hombre gcc

What is gcc?
GCC is a built-in compiler from the GNU project for C, C ++, Objective C, and Fortran; it is capable of receiving a source program in any of these languages ​​and generating an executable binary program in the language of the machine where it will be executed.
The acronym GCC stands for "GNU Compiler Collection". Originally it stood for "GNU C Compiler"; GCC is still used to designate a C build. G ++ refers to a C ++ build.

E XAMPLES

gcc hello.c
compiles the C program hello.c, generates an executable file a.out.
gcc -o hello hello.c compile C program hello.c, generate executable hello file
gcc -c hello.c It does not generate the executable, but the object code, in the hello.o file. If you do not specify a name for the object file, use the file name in C and change the extension to .o.
AMONG OTHERS.

Compilation stages.
The compilation process involves four successive stages: preprocessing, compilation, assembly, and linking. To go from a human-written source program to an executable file, these four steps must be performed in succession. The gcc and g ++ commands are capable of doing the whole process at once.
1. Pre-processed.
At this stage the directives to the preprocessor are interpreted. Among other things, variables initialized with #define are replaced in the code by their value in all places where their name appears
2. Compilation.
The compilation transforms the C code into the assembly language of the processor of our machine.
3. Assembled.
Assembly transforms the assembly language program into object code, a machine language binary file executable by the processor.

to find more about gcc in our terminal we can use the command man gcc or gcc — help.

END.
presented by:

Juan José Arteta Maury

--

--