Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 946
Sabbir Ahmed Avatar asked Jun 18 '26 14:06

Sabbir Ahmed


2 Answers

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

Delete the following files:

  • 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.

Disclaimer: This is only a workaround. It would be best if you tried to see which setting is likely causing the bug.

like image 95
Rohan Bari Avatar answered Jun 20 '26 02:06

Rohan Bari


In settings.json:

"C_Cpp.errorSquiggles": "Enabled"

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

like image 28
Ahmed Ebrahime Avatar answered Jun 20 '26 04:06

Ahmed Ebrahime