The steps of compilation

Lucie Delannay
Sep 30, 2021

What happens when you type gcc main.c?

gcc is used to compile the file. A compiler has several modules: preprocessor, compiler, assembler and linker.

gcc and some options:

gcc -o:

Preprocessor:

Preprocessing is the first step. this is the program that starts before compilation. Its role is to execute the preprocessor lines.it deletes comments, develops macros

Compiler:

The compilation consists in transforming your files into binary code, it compiles all the .c files one by one, hence the importance of having added all your files to the project.

Assembler:

Allows to transform an assembler file into an “object” file.

Linker:

It is a program that assembles all .o binary files into one big file: the final executable a .exe under windows. The .a are assembled with the .o which are the libraries.

--

--