C Preprocessor

When programming with C and C++ it helps to understand a little about what the C Preprocessor is and when the compiler invokes it.

Basically as the name implied the C preprocessor is done before the C++ compiler actually parses the file and compiles the code.

The C preprocessor handles all the commands you see like:

#!cpp #include #define #ifdef #else #endif etc.

So directives like #include are used to suck in the included file and expand it into the context shown the code. The pre-processor runs recursively in any included files which as you can imagine if you #include files which #include many other files and so forth the actual expanded file that is finally passed to the C++ compiler after the pre-processor becomes very large.

See wikipedia for more information.

Related pages