Compiler

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

  1. 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.




要查看或添加评论,请登录

Edher Joe Ramirez Estupi?an的更多文章

  • What happens when you type holbertonschool.com in your browser and press Enter

    What happens when you type holbertonschool.com in your browser and press Enter

    When you want to access a web page on the Internet you need the IP address of the server where it is stored, but as a…

  • Internet of Things (IoT)

    Internet of Things (IoT)

    These are devices that have the physical tools to interconnect, collect and exchange data, among themselves or on the…

  • The differences between static and dynamic libraries

    The differences between static and dynamic libraries

    Why using libraries in general? As we make computer programs, we realize that some parts of the code are used in many…

  • Recursion

    Recursion

    There is an efficient form to repeat a task, in a slightly different manner. By calling a function within itself, to…

    1 条评论
  • Static libraries

    Static libraries

    I′ts a file where we are set a group of routines, external functions and variables But before that, we have to prepare…

  • Hard Links VS Symbolic Links

    Hard Links VS Symbolic Links

    What is a hard link? A hard link is a directory entry that associates a name with a file on a file system. All…

  • How compile gcc (intro)

    How compile gcc (intro)

    The compile process consist of 4 phases: preprcessing, compiling, assembling and linking. The preprocesing: it obeys…

社区洞察

其他会员也浏览了