Prefix header

In computer programming, a prefix header is a feature found in some C or C++ compilers used to ensure that a certain snippet of code is inserted at the beginning of every file.

Prefix headers are usually pre-compiled in order to reduce compilation times.

Use of prefix headers outside of this purpose can make your code more difficult to maintain & less re-usable.

One technique to solve this is to have HAVE_CONFIG_H be a pre-defined macro in the build-system that generates a config.h so that code knows whether it needs to #include config.h (& is safe for use by build systems that do not have it).

On macOS, the Xcode build system generates prefix headers automatically for new projects.