Compiler
In definition, compiling is the action of gatherinf several books, documents or part of them.
A compiler is a computer program that translates computer code written in one programming language into another language. The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language to create an executable program.
There are four steps for compilation
- Preprocessing
In this step, do not include the coments in the code (there are the lines betwen /*-*/). Include the headers, there are at the top of the file, after #include word. Give the macros their values. You can stop the compilation in this step, whit the command "gcc -E filename" and the output is going to save in a file whit ".i" extension.
2. Compiler
Now this step takes the last file and make a IR code (Intermediate Representation). You can stop in this step too, with command "gcc -S filename", you're going to save the output in a file ".s" extention.
3. Assembler
The assembler takes the IR code and transform in to a binari language. If you want to stop in this step, you can do it with the command "gcc -c finlename" and save it in to a file ".o" extension.
4. Linker
This linker make and executable file binary ande make two tasks:
- Links every source file you need to compile for your program.
- Links call functions whit definitions. This linker, knows where is the librarys to find the definitions of the functions you are using it.
After all this process, at last you′re going to recibe the executable file "a.out", you can run it like this "./a.out".
You can change the name of the output but I invite you to read the manual and descover it, maybe if looking how to do this, discover another usefull commands.