VSCode syntax error highlighting is not working for C++ code

Viewed 8684

The C/C++ extension by Microsoft has been installed, and everything works really well. But the VSCode does not seem to show any red underline for syntax errors when there are issues.

I'm using Linux (kubuntu) with the pre-installed g++. I can also successfully build my code and run it.

Any suggestions on how to fix this problem?

3 Answers

After reading the comment of the previous answer, it seems like something is wrong with your settings. One final way possible to fix this issue is to reset the settings of Visual Studio Code to its factory defaults.

Delete the files shown below:

  • For Windows: %APPDATA%\Code\User\settings.json
  • For Linux: $HOME/.config/Code/User/settings.json

Or, do it directly from Code:

  1. Press F1 Type user settings
  2. Press Enter Click the sheet icon
  3. You will be redirected to the settings.json file.
  4. Delete all of its content, save and restart.

In settings.json:

"C_Cpp.errorSquiggles": "Enabled"

from setting.json  "C_Cpp.errorSquiggles": "Enabled",

  1. Go to settings in VS Code
  2. Search for squiggles
  3. Change c_cpp: Error Squiggles to enalbleifIncludesResolve
Related