Appendix C. The Development Environment
The Preprocessor: For #including Files
This appendix explains some of the mysteries of the C preprocessor, class declarations versus including headers, and some best practices to reduce dependencies between header files.
In C++, code reuse is indicated by the presence of a preprocessor directive, #include
, in source code and header files. We #include
header files that contain things like class or namespace definitions, const definitions, function prototypes, and so forth. These files are literally included in our own files before the compiler begins to translate our code.
The compiler will report an error if it sees any identifier defined more than once. It will tolerate repeated declarations but not repeated ...
Get An Introduction to Design Patterns in C++ with Qt 4 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.