Thibaud explains… code compilation— What happens when you type “gcc main.c”?

You CAN teach an old computer new tricks, but that won’t happen if you ask in English.

Compiling C: a 4 step process

C compilation is a 4-step program. That’s 8 less than AA and you’re allowed to drink when they fail!

TL;DR: the compiler

  • reads the source file,
  • processes it in a way that your computer can understand more easily,
  • links it with whatever runtime libraries are required,
  • creates an executable binary file.

Step 1: Preprocessing

Step 2: Compilation

Step 3: Assembling

Step 4: Linking

Example

#include <stdio.h>/**
* main - Prints "Hello, Medium!"
*
*
* Return: Always 0
*/
int main(void)
{
printf("Hello, Medium!\n");
return (0);
}
No turning back now!
Is it a bird? Is it a plane ? It’s not a birdplane, but it’s a wild a.out!
Great Success!

--

--

--

Student at Holberton School France

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

Recommended from Medium

Why competitive programming and why should we consider it?

How to Leverage the Triple Constraint in IT Projects

Principles of an Agile Product Roadmap

Why not hack your news? A simple guide to using the New York Times API in Python

The cool part of ember on apple music

Creating a Shield Damage Feature Using the Alpha Color of a Sprite in Unity — Part 01 (Setting the…

🛍Important Update for GSPI

Checking WildFly, a JavaEE Application Server

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
Thibaud Poncin

Thibaud Poncin

Student at Holberton School France

More from Medium

Module 11 – 3-04-2022

About ICOVO

«Weekly Report» The Change of AIDUS QTS Profit Rate (February 25, 2022)

Closest Casino Near Jackson Ms

Closest casino near jackson ms downtown