Difference between revisions of "cpp/preprocessor/include"
From cppreference.com
< cpp | preprocessor
m (r2.7.3) (Robot: Adding de, es, fr, it, ja, pl, pt, zh) |
m (Text replace - "/sidebar" to "/navbar") |
||
Line 1: | Line 1: | ||
{{title|Source file inclusion}} | {{title|Source file inclusion}} | ||
− | {{cpp/preprocessor/ | + | {{cpp/preprocessor/navbar}} |
Includes other source file into current source file at the line immediately after the directive . | Includes other source file into current source file at the line immediately after the directive . | ||
Revision as of 14:02, 15 June 2012
Includes other source file into current source file at the line immediately after the directive .
Syntax
#include < Template:sparam>
|
(1) | ||||||||
#include " Template:sparam"
|
(2) | ||||||||
Explanation
Includes source file, identified by Template:sparam 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.