Visual Studio Code: IntelliSense stopped finding core c++ includes in MacOS


This Content is from Stack Overflow. Question asked by trbabb

In OSX Monterey, after upgrading a Homebrew install of clang, something about the default C++ headers got screwed up.

I am able to compile from the terminal just fine; it works both if I use the system clang (/usr/bin/clang, which is still the default and the result of which clang), or if I use Homebrew’s more recent clang (/usr/local/Cellar/llvm/14.0.6_1/bin/clang).

However, in VSCode, none of the default C++ headers can be found.

For example, if I #include <iostream>, IntelliSense red-squiggles it and complains cannot open source file "iostream" C/C++(1696).

I have tried restarting VSCode and my machine, I’ve tried Reset IntelliSense Database from the command palette. To the C_Cpp > System Include Path setting, I’ve tried adding /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/; and to the C_Cpp > Mac Framework Path setting I’ve tried explicitly adding /System/Library/Frameworks/. None of these things have fixed the issue.

After upgrading, I also had some issues with clang not finding the system includes which were fixed by reinstalling the XCode developer tools.

  • How do I debug why IntelliSense can’t find the standard headers?
  • How do repair this problem?


This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from stackoverflow and tested by JTuto community, is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?