Compiling a C++ program
Learn the basic steps to convert the C++ program into an executable file.
We'll cover the following
Introduction
In C++, creating an executable file involves three steps:
- Preprocessing
- Compilation
- Linking
To create a simple C++ application first, you need to write source code. Source code is a set of human-readable instructions written in a specific programming language.
📝Note: We save the source code of the C++ program in a file with a cpp extension.
Preprocessing
Lines that start with #
are known as preprocessor directives. Preprocessor directives tell the compiler to preprocess some information before starting the compilation. For example, #include <filename>
is a preprocessor directive. When a preprocessor encounters this statement, it takes the content of the filename
and pastes it into the file that calls the preprocessor directive.
Get hands-on with 1400+ tech skills courses.