自制的Clang找不到C标准库标头

时间:2019-03-11 00:41:42

标签: c++ macos clang homebrew

我用Homebrew安装了clang。如果我尝试编译hello world程序,则会收到此错误:

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能够找到捆绑的C ++标准库头,但找不到C标准库头。 GCC-8(也随Homebrew一起安装)能够找到C标准库头文件。我安装了Xcode,Apple Clang也可以找到C标准库标头。也许这与LLVM仅用于桶的事实有关。

是否有一次性解决方案,这样我就不必为每次clang调用都传递路径了?也许这是自制配方的问题?我希望我不是唯一遇到此问题的人。

0 个答案:

没有答案