I installed clang with Homebrew. If I try to compile a hello world program, I get this error:
In file included from hello.cpp:1:
In file included from /usr/local/opt/llvm/bin/../include/c++/v1/iostream:38:
In file included from /usr/local/opt/llvm/bin/../include/c++/v1/ios:215:
In file included from /usr/local/opt/llvm/bin/../include/c++/v1/iosfwd:96:
/usr/local/opt/llvm/bin/../include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
^~~~~~~~~
1 error generated.
Clang is able to find the bundled C++ standard library headers but not the C standard library headers. GCC-8 (also installed with Homebrew) is able to find the C standard library headers. I have Xcode installed and Apple Clang can find the C standard library headers too. Maybe this has something to do with the fact that LLVM is keg-only.
Is there a one-time fix for this so that I don't have to pass a path to every invocation of clang? Maybe this is a problem with the Homebrew formula?