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 itself 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?