-
Notifications
You must be signed in to change notification settings - Fork 14
Compiler preprocessor
The preprocessor runs before the compiler and is used to do textual insertion of header files (*.h
and *.hpp
), and definitions along with macro expansion. Relying on compiler-specific definitions, you can write source files that are conditionally compiled.
By default, a project created with the IAR Embedded Workbench will search for C/C++ header files in the toolchain's headers default locations ($TOOLKIT_DIR$
/inc) as well as in the project directory ($PROJ_DIR$
).
- Open the project’s options with
Project
→Options
(ALT+F7). - Navigate to the
C/C++ Compiler
→Preprocessor
tab.
In this tab, it is possible to specify Additional Include Directories: (one per line) here.
When one or more source folders are added to the project using the EWPtool, it will traverse the selected source folder(s) in search of header files. Then it will fill the C/C++ Preprocessor entries accordingly.
This tab also permits defining preprocessor symbols. If the original project uses Makefile
or CMakeLists.txt
, these might contain preprocessor definitions required by the application. Once you find them, it is just about bringing these symbols to the Defined Symbols
box. For example:
This is the IAR EWPtool wiki. Back to Home.