Reputation: 343
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 ?
Upvotes: 5
Views: 54360
Reputation: 645
I tried Enabling error squiggles as this answer suggested but that did not work for me so I tried the following:
(Note: I'm using Ubuntu 22.04.4 LTS)
Make sure you have a compiler installed
Reinstall c/c++ extension
Open Command Palette and go to
Welcome: Open Walkthrough...
> Getting Started with C++ Development
and select default compiler and set it as you need
After that open your c++ file and if you're getting a blue squiggly error under the #include
try this solution:
sudo apt-get install gcc-multilib g++-multilib
Doing all this fixed the issue for me:
Upvotes: 0
Reputation: 381
I was having a similar issue with Java, and I was able to resolve it by creating an entirely new directory location for the project and copying the project files from the old to the new — excluding the .vscode
folder.
This is not clearly an ideal fix, however it did work for me.
Upvotes: 0
Reputation: 41
I had this same issue with C# so this is how I ended up here.
Managed to fix it by changing the sln file of the project root directory where:
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "housesapi", "backend\HouseApi\HouseApi.csproj", "{C0FF5955-650A-4458-A35C-50477850354E}"
was incorrect.
After I pointed it to the proper route everything worked and the errors were shown. Here I used the dev kit for C#, a VS Code extension.
Upvotes: 0
Reputation: 21
It worked in my case by just enabling Error Squiggles.
To do this, Open VS Code, press ctrl+shift+p, then, in the search bar, search for "enable error squiggles" and click on it.
Upvotes: 2
Reputation: 377
I got that error by Disable error squiggles. If you don't reach that error in my case, don't read anymore.
After ignoring, I got your problem:
To fix this, open settings.json file:
Scroll to the end, then set "C_Cpp.errorSquiggles": from Disabled to Enabled.
Upvotes: 25
Reputation: 31
Try and close your current folder and open a different folder. Then come back to your original folder. This worked for me.
Upvotes: 2
Reputation: 101
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...
Upvotes: 3
Reputation: 76
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
Upvotes: 5