The Build Process
There are many steps involving in converting a C program into an executable form. These steps are Preprocessing, Compilation, Assembling and Linking.
Preprocessing: During this step the C source code is expended based on the preprocessor directives like #define, #include, #ifdef, #ifndef, #undef, etc. The expended source code is also in C.
Compilation: The expanded source code is then passed to the compiler where syntax errors are identified. These errors are displayed along with warnings. If the expended source code is error free then compiler translates the expended source code in C into an equivalent assembly language program. Different processors support different set of assembly instructions using which they can be programmed. The assembly code is typically stored in .ASM file.
Assembling: The job of assembler is to translate .ASM program into Relocatable Object Code. The .OBJ file is a specially formatted binary file that contains the set of machine language instructions and data resulting from the language translation process.
Linking: The job of the Linker is to combine the individual object files with object files containing library functions. The output of the linker is an executable file in machine language. This file contains all of the code and data from the input object files and is in the same object file format. During linking if the linker detects errors such as mis-spelling the name of a library function in the source code, or using the incorrect number or type of parameters for a function it stops the linking process and doesn't create the binary executable file. Once the EXE file is produced by the linker it would be loaded by Loader in memory and after calling some platform specific initialization functions, main () would be called.