Before continuing

Some concepts

There are a few concepts that we must know before continuing, so let us see them.

Code files

In C/C++, there are two types of code files: Source files and header files. The source files are the ones who contain the C/C++ code to compile into binary code. Header files are used to declare code elements so the compiler is aware they exist when it is compiling a file (More on that later).

Compilation mode

There are two compilation modes: Release and debug. The release mode is the normal compilation mode, the one that is used to produce a release version of a program. The debug mode inserts additional information into the binary files produced in order to help debugging the programs. The result is bigger and slower executable files, it must only be used for development.

An example when compiling a program in debug mode is useful is when the program crashes somewhere we do not know. When compiled in debug mode, it is possible to execute the program using something called a debugger to, for example, retrieve the location in the code where the program crashes.

Compilation output

The compiler does not directly create the executable file. What it does is compile and output a binary object file (extension .o) for each source file inside the project. Then, a program called the linker assembles the object files into the binary executable file.

Console vs graphical application

There are basically two types of application. Graphical applications and console applications. The former is the one we are used to. Console applications looks like that:

Unlike graphical applications, console applications can not display graphics. They can only write (output) and read (input) text. They are way easier to create than graphical applications. We will start with them to learn the basics and then we will go on to graphical applications. They may seem boring, but it is way more fun to work with them than directly trying to create graphical applications and not understanding a thing. We must learn step by step.