Preprocessor Commands
A preprocessor command removes comments from the source code; expands macros; performs conditional inclusions; and includes other files. It is separated from the programming language itself and takes effect before the file is compiled.
Commands
ResCompiler supports the preprocessor commands listed in the following table. All preprocessor command statements must:
-
Begin with a pound (#) sign (except defined(name)).
-
Contain only the preprocessor command.
-
Be written in lower case (except for strings enclosed in quotes).
Command |
Description |
#define name |
Defines the name as 1. |
#define name value |
Sets name to value. If value contains other preprocessor values, they are expanded and used. |
#undef name |
Undefines the specified macro. |
#if expression |
If the expression evaluates to a nonzero value, the expression is true, and the code following the #if expression is included in the resource file. |
#else |
Code to be compiled in an #if expression if the expression is false. |
#endif |
Ends an #if or #else code section. |
defined(name) |
This can be used in an #if expression. If the specified name is currently defined, the defined macro expands to 1, otherwise it expands to 0. |
#include "filename" |
Inserts the file specified by filename at the point the preprocessor is specified. The current directory is searched first followed by the directories given in the -I command line option in the order specified. A maximum of 32 files can be included. |