Say you have 100s of source files (.c or .cpp) files, and you want to include some definitions, function/variable declarations in each of them. Normally in C/C++, you use he
You can't do that, although you could write a script for you to do it. A script that takes each files, and writes Edit: #include "header.h"
at top.-include
in gcc does this.
However, what you need is achievable in a different way through the compiler options. In gcc, with -D
.
Let's say, you want the define DEBUG_LEVEL
to 2 in all your source files. You can simply do this by invoking gcc like this:
gcc -DDEBUG_LEVEL=2
Note that in this case, you would need to rebuild all your project (which would have been done anyway if you had changed this definition in 1 header file to which ALL the source files depend on)