How to C++ compilation works? Compiling a C++ program involves a number of steps (most of which are transparent to the user):
First the C++ preprocessor goes over the program text and carries out the instructions specified by the preprocessor directives (e.g #includes). The result is a modified program text which no longer contains any directives
Then the C++ Compiler translates the program code. The compiler may be a true C++ compiler which generates native (assembly or machine) code or just a translator which translates the code into c. In the latter case the resulting c code is then passed through a c compiler to produce native object code. In either case the outcome may be incomplete due to the program referring to library routines which are not defined as a part of the program.
Finally the linker completes the object code by linking it with the object code of any library modules that the program may have referred to. The final result is an executable file
Thanks |