2

Every now and then my VSCode IDE does not highlight errors in my C++ code anymore. Reloading the window, restarting VSCode or re-installing the extensions does not help.

Example:

void some_func() {
   int some_num = 1;
   some_nmn++; // should give error, since variablename contains typo. No error indicated.
}

In terms of C++, I am using the extensions only C/C++, however I also use a couple of other extensions that are helpful in the context, like CMake and Code Runner.

User12547645
  • 6,955
  • 3
  • 38
  • 69

2 Answers2

3

Apparently there were two things wrong with my setup: I had the wrong standard and I used the wrong Intellisense Engine.

Change the Intellisense Engine by doing Ctrl + Shift + P -> Preferences: Open Settings (UI) -> Enter C_Cpp: Intelli Sense Engine in the search bar. In the drop-down menu select Default.

After that I got a lot of unnecessary warnings regarding std, e.g. namespace std has no member optional (see post).

I fixed it by changing the standard in my workspace settings. Ctrl + Shift + P -> Open Workspace Settings (JSON). Add this line:

"C_Cpp.default.cppStandard": "c++17"

Be aware that the first setting is global and the second setting is only for your current workspace.

User12547645
  • 6,955
  • 3
  • 38
  • 69
1

Something else must be wrong in your settings, or maybe some conflict. Now as you uninstall VS Code it's possible that these settings are not erased, you can check the folders where the settings are kept and delete the them if necessary, the default locations for the settings are:

For Windows:

%APPDATA%\Code\User\settings.json

For macOS:

$HOME/Library/Application Support/Code/User/settings.json

For Linux:

$HOME/.config/Code/User/settings.json

anastaciu
  • 23,467
  • 7
  • 28
  • 53