#include errors detected in vscode
Solution 1
The answer is here: How to use C/Cpp extension and add includepath to configurations.
Click the light bulb and then edit the JSON file which is opened. Choose the right block corresponding to your platform (there are Mac
, Linux
, Win32
– ms-vscode.cpptools version: 3). Update paths in includePath
(matters if you compile with VS Code) or browse.paths
(matters if you navigate with VS Code) or both.
Thanks to @Francesco Borzì, I will append his answer here:
You have to Left 🖰 click on the bulb next to the squiggled code line.
If a
#include
file or one of its dependencies cannot be found, you can also click on the red squiggles under the include statements to view suggestions for how to update your configuration.
Solution 2
Close and re-open Visual Studio Code.
Solution 3
If you are working with cmake-tools and the error messages says something is wrong with the configurationProvider, then following actions solved the issue for me:
- Open c_cpp_properties.json. (windows key on windows or cmd key on mac + shift + p, enter "c/c++ edit configurations" and chose 'json'.
- Enter ms-vscode.cpptools as value for configurationProvider instead of ms-vscode.cmake-tools or whatever you have.
How it should look like after the replacement of configurationProvider:
One other important configuration is the include path. The assumption is that you have this configuration right. May be like following
Solution 4
- Left mouse click on the bulb of error line
- Click
Edit Include path
- Then this window popup
- Just set
Compiler path
Solution 5
I ended up here after struggling for a while, but actually what I was missing was just:
If a #include file or one of its dependencies cannot be found, you can also click on the red squiggles under the include statements to view suggestions for how to update your configuration.
source: https://code.visualstudio.com/docs/languages/cpp#_intellisense

banan3'14
Updated on January 06, 2022Comments
-
banan3'14 12 months
I am using Visual Studio Code in my C++ project. I installed Microsoft C/C++ Extension for VS Code. I got the following error:
#include errors detected. Please update your includePath. IntelliSense features for this translation unit (
/path/to/project/file.cpp
) will be provided by the Tag Parser. -
Hatted Rooster almost 4 yearsPlease add that your answer contains a part of @Francesco's answer, as in, he was first but you're just adding it to yours for visibility. Otherwise it looks like Francesco is blatantly copying your answer.
-
banan3'14 almost 4 yearsRight, forgot to acknowledge him
-
Scott McPeak over 3 yearsRegarding
includePath
andbrowse.path
: your explanation is not quite right. Both are used while browsing, neither is used during compilation. See the VSCode FAQ and another answer of mine. -
Aaron Franke almost 3 yearsWhat do I do if the include error is a native library? VS Code is complaining about
#include <mono/metadata/assembly.h>
-
Aaron Franke almost 3 yearsWhat if there are no suggestions?
-
Ethan Groat over 2 years'Add to "includePath"' is not an option on my editor, which does have the C/C++ extension. Could I get some insight as to why?
-
banan3'14 about 2 years@EthanGroat, perhaps you have disabled error squiggles? Could you check options
C_Cpp.errorSquiggles
andC_Cpp.default.enableConfigurationSquiggles
in settings? -
Sihat Afnan almost 2 yearsIf you don't have g++ installed, install it with
sudo apt-get install g++
-
Mrityunjai over 1 yearsimple and to the point! Is there any shortcut like invalidate cache and rebuilt indexes?
-
J-D3V over 1 yearIf there is a lightbulb, there are suggestions
-
Aqua about 1 yearThis fixed my issue! Thank you!
-
akash about 1 yearAfter above steps, please restart the vs code.
-
Aaron Franke about 1 yearI have this set to
/usr/bin/g++
, IntelliSense mode set to linux-gcc-x64, and the include path set to include${workspaceFolder}/**
and I still get include path errors. I do have GCC and G++ installed. I have the same problem with Clang. -
Pluviophile about 1 yearThis does not provide an answer to the question. Once you have sufficient reputation you will be able to comment on any post; instead, provide answers that don't require clarification from the asker. - From Review
-
BugHunterUK 11 monthsThe problem is, I am not getting the option to add to the include path.
-
banan3'14 11 months@BugHunterUK is it possible to add/change
includePath
manually? See this answer for further guidance stackoverflow.com/a/68139743/7769052. -
Hassan Risvy 7 monthsSimple & Starightforward! Solved my problem! Thanks!
-
Alessandro Giusa 7 monthsBefore making this change, check if a restart of vscode helps.
-
HAO LEE 6 monthsThis is the correct solution!!!!!