DEV Community

Pierre Bouillon
Pierre Bouillon

Posted on • Edited on

Explain me C compilation like I'm five

With/Without librairies, makefiles, several files, etc.
I'm a truly beginner with this and I didn't understand a damn thing.

Thanks !

Top comments (6)

Collapse
 
mcr42_19 profile image
mcr42 • Edited

To dig a bit deeper, the process of building a program consists actually of 2 parts:
Compiling is converting each C file into machine code ( objects), and
Linking is putting all the objects together to create the executable file.
Libraries are (mostly) just prebuilt object files someone else prepared for you.

Collapse
 
andreanidouglas profile image
Douglas R Andreani

What is the role of the OS here? Does it interfere with the type of machine code? Does the compiler require to link additional libraries in order to run the program on certain os?

Collapse
 
pbouillon profile image
Pierre Bouillon

Thanks ! Very helpful !

Collapse
 
brovic profile image
Victor Ordu

Lovely.