Overview of the preprocessor
The preprocessor of the IAR C/C++ Compiler for RISC-V adheres to Standard C. The compiler also makes these preprocessor-related features available to you:
Predefined preprocessor symbols
These symbols allow you to inspect the compile-time environment, for example, the time and date of compilation. For more information, see Description of predefined preprocessor symbols.
User-defined preprocessor symbols defined using a compiler option
In addition to defining your own preprocessor symbols using the
#definedirective, you can also use the option-D, see -D.Predefined preprocessor macro symbols
Use the option
‑‑predef_macrosto see the predefined preprocessor macro symbols and their values for a specific command line. For more information, see ‑‑predef_macros.Preprocessor extensions
There are several preprocessor extensions, for example, many pragma directives. For more information, see Pragma directives. For information about other extensions related to the preprocessor, see Descriptions of miscellaneous preprocessor extensions.
Preprocessor output
Use the option
‑‑preprocessto direct preprocessor output to a named file, see ‑‑preprocess.
To specify a path for an include file, use forward slashes:
#include "mydirectory/myfile"
In source code, use forward slashes:
file = fopen("mydirectory/myfile","rt");Tip
Backslashes can also be used—use one in include file paths and two in source code strings.