Visual Studio Code
Use Visual Studio Code with Microsoft's C/C++ extension to control the preprocessor macros used by Intellisense by
creating a header file containing #define and #undef directives.
In the Visual Studio Code settings, search for "Forced Include" and specify the path to the header file. This file will be automatically included in all C/C++ source files.
If you provide an absolute path, it applies to all files globally.
To make the header workspace-specific, use the following path:
${workspaceFolder}/preinclude.hIf you're using the QNX Toolkit and have either created a QNX project or configured an existing non-QNX project using the Toolkit (QNX > Generate .vscode files), the .vscode folder includes the following files (among others):
- c_cpp_properties.json — C/C++ extension configuration.
- preinclude.h — a header file that is automatically pre-included in your source code.
Note that these files override the default settings. Therefore, update the .vscode/preinclude.h file as needed.
Example content of the preinclude.h file:
#undef __linux__
#define __QNX__ 800
#define __unix__If you only want to add new preprocessor variables, you can search for "Defines" in the Visual Studio Code settings and add them under C_Cpp > Default: Defines.
