What happens when you type gcc main.c?

gcc is the C compiler of choice for most UNIX. The program gcc itself is actually just a front end that executes various other programs corresponding to each stage in the compilation process.

A C file is a source code file for a C or C++ program. And .c is the C file extension.

There are 4 steps:

Preprocessor:

This is the first step, this places all files into your .c file, and it also translates all macros into inline C code.

Compiler:

Compiler convert files genereted by preprocessor as an imput and generetes an assembly code.

Assember:

Our machine can only read binary, we need to convert the assembly code so the machine can read it. This is what the Assember step does.

Linker:

This step will link our object code with the library code and generate it exe files.

So when we type gcc main.c, we are compiling the main.c file and making an executable code.

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Why switch from BASH shell to KSH in Kali Linux?

Effective Ways of Managing Your Terraform State

General programming books to get better with

Introduction to Flexbox

Fixing “comma-separated values” output for multi-line fields in MuleSoft

Infrastructure Engineering: Bootstrapping

Explore zenity

The Angular DevOps Series: CT and Code Coverage with TeamCity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tadeo Grach

Tadeo Grach

More from Medium

The Beasts and Witches in the Hills

The Dark Forest

Devotion for Adventure and Risk Taking: The Story about Huarisanchi

On the topic of “Intellectual Vitality”…