What Can be Precompiled
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 C or C++ 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.
- A C++ source code file that will be automatically precompiled must have a .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 Carbide IDE project, although a project must be open to precompile the file.
The Carbide 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. C++ source code can contain inline functions and constant variable declarations (const).
- Precompiled header files for different build targets are not interchangeable.
For example, to generate a precompiled header for use with Windows® compilers, you must use a Windows® compiler.
- C source code may not include precompiled C++ header files and C++ source code may not include precompiled C header files.
- 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).