'For C/C++ syntax highlighting in vscode : how to tell vscode that a compile option "-Dxxxx" will be used?

When developing for micro controller, we use a lot of compile-time defines passed to the compiler with the "-Dxxxx" syntax. I would like to configure vscode such that it knows that certain defines will be provided and such that it highlights code properly corresponding to those info.

How would I do that ?



Solution 1:[1]

I am assuming you have C/C++ extension installed.

1 - Open Command Palette by Ctrl + Shift + P or View -> Command Palette...
2 - Select C/C++: Edit Configurations (UI)
3 - Scroll down to Defines section, where you can add your defines/macros.

Also, In this tab you can tell vscode about your compiler options such as, the compiler arguments, the language standard you are using, include paths, etc.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 whh