What happens when you type gcc main.c
GNU
It is a operating system that is compatible with Unix, it was developed by the GNU project, which started in 1983 by Richard Stallman; he wanted to produce non-proprietary software.
C
C is a programming language very known around the world, it is one of the firs 10 programming languages. Programming languages are divided into two categories:
Interpreted languages:
Compiled languages: C is a compiled language, which means that it has the next process; preprocessed, compiled, assembled, and finally linked. With these 4 process the program runs (it happens when gcc main.c is ran from your terminal)
GCC
GNU means Compiler Collection and was originally written to be the compiler for the GNU OS. It compilers the following languages: C, C++, Objective-C, Fortran, Java, and more.
gcc main.c
It runs four steps and always in the same order
Preprocessing
It is a separate program that is called by the compiler before the actual translation begins. Such a preprocessor can delete comments, include other files and replace macro substitutions.
You can preprocess a “c file†by running the following command
$ gcc -E main.c
Compilation
A compiler is a type of translator that transforms a program from one programming language (called source code) to another. The above command creates a file called main.s which contains the assembly code for the main.c file
To generate assembly code from a C source file, see the following
$ gcc -S main.c
Assembly
It is the phase of the software compilation, which consists of transforming a file written in assembly language into an object file or binary file. The output of the assembler is put in a file called main.o . This output becomes the final input into what is called the linker in the compilation process
Linking
The linker is a process that accepts as input object files and libraries to produce the final executable program. The linker accepts the main.o as input and it also accepts any pre-compiled libraries that were imported with the #include preprocessor directiv