Difference between revisions of "Compiler"

From Chilipedia
Jump to: navigation, search
(The Details)
(The Details)
Line 2: Line 2:
  
 
== The Details ==
 
== The Details ==
To be completely accurate, the compiler by itself doesn't actually output the .exe file. That's done by a separate program called a linker. The compiler processes each .cpp file in your project, turning your C++ statements into machine code that the CPU can understand, and outputs an .obj (object) file that contains machine language instructions for each one processed. The linker then jams all the objects together and links up the function calls, outputting that sweet, sweet binary executable.<br /><br />
+
To be completely accurate, the compiler by itself doesn't output the .exe file. That's done by a separate program called a linker. The compiler processes each .cpp file in your project, turning your C++ statements into machine code that the CPU can understand, and outputs an .obj (object) file that contains machine language instructions for each one processed. The linker then jams all the objects together and links up the function calls, outputting that sweet, sweet binary executable.<br /><br />
 
Now compilation of a .cpp file generally proceeds in two phases. The first phase is called 'preprocessing', and we generally say that this is carried out by the 'preprocessor', although in actuality there is no separate program for the preprocessor, it's just a routine run by the compiler. After preprocessing, the compilation proper begins and an .obj file is pooped out. Other files with metadata for debugging purposes etc. may also be pooped out.
 
Now compilation of a .cpp file generally proceeds in two phases. The first phase is called 'preprocessing', and we generally say that this is carried out by the 'preprocessor', although in actuality there is no separate program for the preprocessor, it's just a routine run by the compiler. After preprocessing, the compilation proper begins and an .obj file is pooped out. Other files with metadata for debugging purposes etc. may also be pooped out.

Revision as of 11:05, 1 August 2016

What's a compiler? A miserable little pile of secrets! No, actually Dracula, it's a program that takes source code, goes 'NOM NOM NOM', and poops out an executable. Duh.

The Details

To be completely accurate, the compiler by itself doesn't output the .exe file. That's done by a separate program called a linker. The compiler processes each .cpp file in your project, turning your C++ statements into machine code that the CPU can understand, and outputs an .obj (object) file that contains machine language instructions for each one processed. The linker then jams all the objects together and links up the function calls, outputting that sweet, sweet binary executable.

Now compilation of a .cpp file generally proceeds in two phases. The first phase is called 'preprocessing', and we generally say that this is carried out by the 'preprocessor', although in actuality there is no separate program for the preprocessor, it's just a routine run by the compiler. After preprocessing, the compilation proper begins and an .obj file is pooped out. Other files with metadata for debugging purposes etc. may also be pooped out.