What happens when you type gcc main.c

Brayan Florez
2 min readSep 19, 2019

First, we have to recognize that all files ending with “.c extension” are C programming files and knowing that in advance we can continue.

We also have to understand all the compilation process of a .c file.

Pre-processor: Basically in this step, it processes the file and it takes it into the compiler.

To do this operation we need to use gcc -E

Compiler: This is the second step in which the file it’s translated into machine code.

To do this operation we need to use gcc -S

Assembler: It compiles the file into binary code.

To do this operation we need to use gcc -c

Linker: This is the final process in which it creates the final executable file.

Note: We use gcc -o <file> place the output into <file>

In summary, when we use gcc main.c it creates an executable called “a.out”.

Sign up to discover human stories that deepen your understanding of the world.

Free

Distraction-free reading. No ads.

Organize your knowledge with lists and highlights.

Tell your story. Find your audience.

Membership

Read member-only stories

Support writers you read most

Earn money for your writing

Listen to audio narrations

Read offline with the Medium app

No responses yet

Write a response