What happens when you type gcc main.c

Within the Linux operating system, there is a built-in command called “gcc”. It is a C compiler, which basically means it takes source code (C language script) and turns it into an executable file. Here’s how:

There are three steps gcc takes to fulfill this command. First, it reads the source file, or C language script. Second, it processes it. Thirdly, gcc links it with a runtime library.

The pre-processor takes care of the first step. It will remove comments written by the author, then add a header, and replace macros with the actual thing.

The assembler assembles the above code into whats called “object code” which can be read by the linker.

The linker will take the code and put it all into a single file and make it executable. Two common outputs are readable for windows (.exe) and UNIX / UNIX-like systems like Linux. The Linux files normally do not need an extension.

--

--

--

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

Recommended from Medium

What do Web Developers need to know about Atom?

So Node.js…?

Free and Open Source Software is Dead

Deploy dapps leveraging the AWS Hyperledger Fabric template - an unofficial guide (Part 2)

New Android O — what does it mean to you as a developer?

Surface Neo and Windows 10X, which are changing the world of laptops

Surface Neo and Windows 10X, which are changing the world of laptops

AMA Recap of Dude’s Army x Modefi

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
Reese Hicks

Reese Hicks

More from Medium

What’s Spreading in the Music Prime?

Efficacy of REX THE TREX AND MREX

Update #3: United in Grief

Hippie Highlight #3