C++ pre-processor statements

The following pre-processor statements are supported by the resource compiler:

  • #define

  • #undef

  • #line

  • #include

  • #ifdef

  • #ifndef

  • #if

  • #else

  • #endif

The following sections give more detail on the use of the #ifdef and #include statements.

Conditional compilation in resource files

The resource compiler supports conditional compilation such as

#ifdef SOMETHING 
// do something 
#else 
// do something else 
#endif

or

#ifndef WHATEVER 
// do something 
#endif

Include files within a source file

You can include files within the source file by using a #include directive, for example:

#include <eikdef.rh>

or

#include "eikdef.hrh"

The searching algorithm used by the resource compiler depends on whether the item to be included is enclosed in double-quotes or angled brackets.

If the filename is enclosed in double-quotes, the resource compiler searches for that file through the following directories in the following order:

  • the current directory

  • the relative directory ..\inc

  • the absolute directory epocroot \epoc32\include

If the filename is enclosed in angled brackets, the resource compiler searches for that file through the following directories in the following order:

  • the relative directory ..\inc

  • the absolute directory epocroot \epoc32\include