To understand the compilation process let’s create a project with name project_name and suppose this project has 2 files-
There are 4 stages involved in the creation of executable file project_name.exe from these source files.
It is the first stage when we give build command.At this stage, Two main task is performed-
File_name1.c ———-Converted into———> File_name1.i
File_name2.c ———-Converted into———> File_name2.i
At the 2nd stage,
File_name1.i ———-Converted into———> File_name1.s
File_name2.i ———-Converted into———> File_name2.s
The compiler creates assembler file(.s) which has some sets of instructions and handed over to assembler.
At the 3rd stage,
File_name1.s ———-Converted into———> File_name1.o
File_name1.s ———-Converted into———> File_name1.o
At this stage, all the assembly instructions of each file converted into machine code.
At this stage,
All the linking work is done to functions and creates an executable file.