ARTICLE AD BOX
If you use VSCode's C/C++ extension, you can define it on your own in .vscode/c_cpp_properties.json:
{ "configurations": [ { "name": "Linux", "intelliSenseMode": "linux-gcc-x64", "compilerPath": "/usr/bin/g++-15", "defines": [ "__VSCODE__=1" ] } ], "version": 4 }Now edit a file like this:
#ifdef __VSCODE__ constexpr auto x = 1; #else constexpr auto x = 2; #endif static_assert(x == 1);You will find that in VSCode there is an error squiggle on the static assertion, but if you compile it normally there are no errors.
8094 silver badges14 bronze badges
Explore related questions
See similar questions with these tags.
