In the last tutorial, we discussed the question: What is the meaning of building the code, and why does the Code::Blocks IDE require us to build the code before running it?
Now, let’s explore the answer to this question.
To understand why we need to build the code, we must first take a closer look at what happens behind the scenes to enable the final output on the console window (also known as the “black screen”).
The entire process of program execution is outlined below:
According to the diagram, Build is the complete process of obtaining an executable from the source code, and Run is the process of obtaining the desired output from the executable. This is all we need to understand for now, and we will comprehend the rest of the elements in the diagram as we proceed.
When we build and run the code in Code::Blocks, two additional files are generated in the same folder where our program is stored: an object file (with the “.o” extension) and an executable file (with the “.exe” extension). Code::Blocks provides these files with a single click of a button (either “Build” or “Build and Run”). The “expanded source code” and the “assembly code” are always hidden from us.
The diagram shows that there are four main stages involved in the process of generating output from the source code: preprocessing, compilation, assembly, and linking. To easily understand the entire process, separate tutorials are dedicated to each stage. This will help us comprehend the entire process effectively.
The next tutorial is dedicated to the preprocessing stage. I will see you there.
Leave a comment