VSCode does not show errors before building

Viewed 13994

I use VSCode(code editor, not IDE) for C++ with only Microsoft's C++ extension and today I have encountered a problem here. When I write the wrong syntax, the "PROBLEMS" panel does not show errors. It only shows errors on building the code. Earlier that wasn't the case. How do I fix this ?

Before building: enter image description here

After building: enter image description here

enter image description here

4 Answers

I got that error by Disable error squiggles. If you don't reach that error in my case, don't read anymore.

enter image description here

After ignoring, I got your problem:

enter image description here

To fix this, open settings.json file:

enter image description here

Scroll to the end, then set "C_Cpp.errorSquiggles": from Disabled to Enabled. enter image description here

After reading the question, and the comments, my understanding is that you want Visual Studio Code to tell you when you make a mistake on the sintax, without having to compile the project.

What could be wrong is your C++ IntelliSense, which is odd because it comes in bundle with the C/C++ extension from Microsoft. The extension itself might be disabled, corrupted during an aborted update, or uninstalled.

Have you tried the good old and helpful uninstall and reinstall the extension? That normally fixes my problems with extensions in Visual Studio and VS Code

Note: You have to install the extension first: C/C++ IntelliSense, debugging, and code browsing extension

This is because the C/C++ IntelliSense, debugging, and code browsing extension does not know about the current project.

Navigate to View | Command Palette, enter and select C/C++ Build and debug active file: Select Project, and then select the correct project that you want to work with.

This will help you see the problems as you create your code without requiring you to run it.

The extension has to know that it is allowed to continuously check your code.

I hope this helps you in the future with other extensions too...

Try and close your current folder and open a different folder. Then come back to your original folder. This worked for me.

Related