Do you G-C-C What I See?

WHAT IN THE WORLD IS GCC?!?

Great question, GCC stands for GNU Compiler Collection. This is an optimizing compiler that supports various programming languages. One of them being, the C Language that we are currently learning at Holberton School through project based and collaborative peer learning.

Compilation

There are exactly four steps to Compilation. Let’s begin.

Diagram of Compilation Process for visual learners.

Preprocessing

First, we have our code that is written in a text editor like emacs or vim (pssst… EMACS) and then the file is given an extension of .c. This is the extension for all C files. Then, when passed through the preprocessor as the first step, it is expanded and passed to the compiler.

Compiling

Next, the compiler will process the source code into assembly code. We’re gettin fancy now! Files that have gone through with this step typically have extensions of .i or .ii.

Assembling

From here, the assembly code is then converted into object code and the object file’s name generated is the same as the source file. Files that have gone through assembly have the extension of .s

Linking

Last but not least! This is an essential step to making sure your file does what it is supposed to do. The linker will take all the object files and combine them into a single executable file, or library file, or other “object file”. The file will reach its final stage and have a .o extension to signify its transition to the dark side. If you do not specify what you want to be the name of your object file, it will generate the standard, which is ./a.out.

I have included a coding example from my own terminal window to illustrate my understanding of gcc and how it works:

Thank you for reading along, I appreciate and am open to any feedback that will make my posts better in the future.

Student at Holberton School