O'Reilly logo

Navigating C++ and Object-Oriented Design by Gail Anderson, Paul Anderson

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required