2.2. Preprocessor Directives

The preprocessor is separate from the C++ compiler and has its own syntax rules. Programs use the preprocessor to include header files, provide textual substitutions before compilation, and conditionally compile lines of C++ code. Preprocessor directives start with a # as the first character on a line. A backslash (\) preceding a return continues a directive to the next line. The preprocessor accepts directives anywhere in a source file, and directives may appear inside other directives.

Include File Directive

The include file directive compiles lines from other files in your code. The two include file directives are

#include "file" 
#include <file>

The first directive searches your current directory for file before ...

Get Navigating C++ and Object-Oriented Design now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.