Steps of Compilation
Four Steps of Compilation:
Compiling
Preprocessing: Is the first step, it´s function is to remove comments, expanding macros and expanding included files. All preprocessor commands begin with a hash symbol (#). It must be the first nonblank character, and for readability, a preprocessor directive should begin in the first column.
Compiling: Compiling is the second step. It takes the output of the preprocessor and generates assembly language, an intermediate human readable language, specific to the target processor.
Assembly: During this stage, an assembler is used to translate the assembly instructions to object code (binary code). The output consists of actual instructions to be run by the target processor.
Linking: The object code generated in the assembly stage is composed of machine instructions that the processor understands but some pieces of the program are out of order or missing. To produce an executable program, the existing pieces have to be rearranged and the missing ones filled in. This process is called linking.
The linker will arrange the pieces of object code so that functions in some pieces can successfully call functions in other ones. It will also add pieces containing the instructions for library functions used by the program.
The result of this stage is the final executable program.