Reputation: 500
IntelliSense is incorrectly marking boolean operators (and
, or
, etc.) As errors. Here is an example:
This is my c_cpp_properties.json
:
{
"configurations": [
{
"name": "Win32",
"includePath": [
"${workspaceFolder}/**"
],
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
"compilerPath": "C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe",
"cStandard": "c17",
"cppStandard": "c++17",
"intelliSenseMode": "${default}"
}
],
"version": 4
}
Anyone knows why this is happening?
Upvotes: 2
Views: 154
Reputation: 9165
With Visual C++, it looks like you need to add #include <iso646.h>
.
C++ specifies
bitand
as an alternative spelling for&
. In C, the alternative spelling is provided as a macro in the <iso646.h> header. In C++, the alternative spelling is a keyword; use of <iso646.h> or the C++ equivalent is deprecated. In Microsoft C++, the /permissive- or /Za compiler option is required to enable the alternative spelling.
After including the header file, it no longer errors:
Some compilers, such as Microsoft Visual C++ have, at least in the past, required the header to be included in order to use these identifiers.
Upvotes: 1