0

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?

1 Answer 1

1

This was fixed after

  • Upgrading XCode (not just the developer tools, but the entire app; autoupdates had stopped due to limited disk space), and

  • Disabling the C++ extension and then re-enabling it.

Upgrading XCode by itself did not fix the issue, it didn't work until C++ was disabled and then re-enabled. I don't know if the former was actually necessary or not.

Restarting the machine and bouncing VSCode itself was not sufficient either.

I'm not sure why it was necessary to toggle the extension, but it's certainly easier than uninstalling and re-installing VSCode (which was the next thing I was about to try).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .