Precompiled Headers

Precompiled header support is available for Symbian OS projects that use the Nokia x86 compiler. Precompiled header files use the .pch++ extension and are only supported by emulator targets.

By default, the x86 compiler compiles the .pch++ file before compiling any .cpp files in a project.

A precompiled header file (.pch++) outputs to a new identically named file with the .mch extension. For example, HelloWorld.pch++ outputs as HelloWorld.mch. C++ source files must use the .pch++ extension.

Listing 1 shows an example of a precompiled header source file called pch_test.pch++.

Listing 1 .pch Precompiled Header example

#include <e32def.h>
#pragma precompile_target "pch_test.mch"

#define FOO 1
#define LATIDA 345

typedef struct foo
{
    int i, j, k, l, m;
    char foobar[256];
} foo;

The resultant output file, pch_test.mch can be included in other source or prefix files as:

#include pch_test.mch