Preprocessor

Header File (C++) The C Preprocessor is just a text substitution tool to allow extra pre-processing before the actual compilation.

#ifndef MOTION2D_H
#define MOTION2D_H
...
#endif 

Above are preprocessor directions: commands that allow transformations of the source code before it is compiled.

For C++

C++ has many tools such as inline functions that may be better suited compared to a preprocessor definition such as a macro.

Example

Seen in Lecture 7 of CS247 - Software Engineering Principles

Break circular dependencies using Forward Declaration. Another trick is to put #include in the .cpp files instead of .h files. We had a lot of circular dependencies issues while trying to compile our chess engine project for CS247 - Software Engineering Principles.

Preprocessor Directives

All preprocessor commands begin with a hash symbol #.

Forward Declaration