O'Reilly logo

C++ for the Impatient by Brian Overland

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

Chapter 8. Preprocessor Directives

A directive—unlike a declaration or executable statement—is a general command to the compiler carried out by the preprocessor. The preprocessor decides which lines to compile; it also carries out search-and-replace on the source code before the rest of compilation takes place. Although the compiler never alters the original copies of the source files, the effect is as if the files were changed just prior to being compiled.

Probably the most essential directive is #include, which brings in a set of declarations from another file, saving the considerable work you’d do if you had to declare everything yourself.

Another use for directives is conditional compilation, which is a way to maintain different versions ...

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