Preprocessor Configuration: Definition
Let's learn about the preprocessor, the first step of the compiler.
The preprocessor plays a huge role in the process of building. Maybe this is a little surprising, given how simple and limited its functionality is. In the following sections, we'll cover providing paths to included files and using the preprocessor definitions.
Providing paths to included files
The most basic feature of the preprocessor is the ability to include .h
/.hpp
header files with the #include
directive. It comes in two forms:
#include <path-spec>
: Angle-bracket form#include "path-spec"
: Quoted form
As we know, the preprocessor will replace these directives with the contents of the file specified in path-spec
. Finding these files may be an issue. Which directories do we search, and in what order? Unfortunately, the C++ standard doesn't exactly specify that; we need to check the manual for the compiler we use.
Typically, the angle-bracket form will check standard include directories, including the directories where standard C++ library and standard C library headers are stored in the system.
The quoted form will start searching for the included file in the directory of the current file and then check the directories for the ...