'Erroneous Syntax Highlighting for GCC C in VS Code

Ever since I downloaded Visual Studio on my computer, syntax highlighting and IntelliSense has been erroneous in VS Code for my C programs. For example, this code

int main()
{
   unsigned long long size = 3;

   int a[size];

   return 0;
}

has the size variable underlined in red in the square brackets. Other things seem off, too. For example, the __uint128_t type used to show up in the IntelliSense recommendations, but now it does not. Also, in order to include definitions from the <math.h> header file, I need to include #define _USE_MATH_DEFINES now, otherwise VS Code will not recognize any of the macros.

All of the code listed above still compiles just fine for me, but the erroneous syntax highlighting can get a bit annoying. My theory is that the VS Code editor thinks that I am using an MSVC compiler instead of GCC. My friend who doesn't have Visual Studio has none of these problems. I can't think of any other reason for why this is happening.

Is there a way that I can fix this, like maybe changing the compiler options in settings? Thanks.



Sources

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

Source: Stack Overflow

Solution Source