A file to be precompiled does not have to be a header file (
.h or
.hpp files, for example), but it must meet these requirements:
- The file must be a source code file in text format.
You cannot precompile libraries or other binary files.
- A C source code file that will be automatically precompiled must have
.pch file name extension.
- Precompiled files must have a
.mch file name extension.
- The file to be precompiled does not have to be in a CodeWarrior IDE project, although a project must be open to precompile the file.
The CodeWarrior IDE uses the build target settings to precompile a file.
- The file must not contain any statements that generate data or executable code.
However, the file may define static data.
- Precompiled header files for different build targets are not interchangeable.
- A source file may include only one precompiled file.
- A file may not define any items before including a precompiled file.
Typically, a source code file includes a precompiled header file before anything else (except comments).