Source file inclusion
From Cppreference
< cpp | preprocessor
C++ Standard Library |
---|
C++ language |
Preprocessor |
Includes other source file into current source file at the line immediately after the directive .
[edit] Syntax
#include <filename> | (1) | ||||||||
#include "filename" | (2) | ||||||||
[edit] Explanation
Includes source file, identified by filename into the current source file at the line immediately after the directive.
The first version of the directive searches only standard include directories. The standard C++ library, as well as standard C library, is implicitly included in standard include directories. The standard include directories can be controlled by the user through compiler options.
The second version firstly searches the directory where the current file resides and, only if the file is not found, searches the standard include directories.
In the case the file is not found, program is ill-formed.