【发布时间】:2019-03-08 19:21:09
【问题描述】:
安装 clang++(尝试 v. 6.0.1 和 7.0)后:brew install --with-toolchain llvm
非常琐碎的程序会导致以下错误:
In file included from test.cpp:1:
In file included from /usr/local/Cellar/llvm/7.0.0/include/c++/v1/iostream:38:
In file included from /usr/local/Cellar/llvm/7.0.0/include/c++/v1/ios:215:
In file included from /usr/local/Cellar/llvm/7.0.0/include/c++/v1/iosfwd:90:
/usr/local/Cellar/llvm/7.0.0/include/c++/v1/wchar.h:119:15: fatal error: 'wchar.h' file not found
#include_next <wchar.h>
用于编译的命令:
clang++7() {
LDFLAGS="-L/usr/local/opt/llvm/lib -Wl,-rpath,/usr/local/opt/llvm/lib"
CPPFLAGS="-I/usr/local/opt/llvm/include"
/usr/local/opt/llvm/bin/clang++ -std=c++11 $CPPFLAGS $LDFLAGS $1
}
可以用官方的clang代替苹果的版本吗?
对于 Apple 的版本,我们甚至不知道它到底是哪个版本的 LLVM...
【问题讨论】:
-
在 Mac OS X 上,您通常会得到
clang作为XCode的一部分。您从自制软件中尝试的任何具体原因? -
@bobah Xcode 附带了哪个 clang 版本?
Apple LLVM version 10.0.0 (clang-1000.11.45.2)对我们来说意义不大,不是吗?我想尝试某些 C++17 或 C++2a 功能,并且想知道我正在使用的确切 clang 版本。 -
lmgfy - stackoverflow.com/questions/33603027/… :-)
-
@boobah 向下滚动。这篇文章中的解决方案不再起作用;)
-
该死!但我仍然会尝试
__cplusplus和基于每个功能宏的代码内测试方法,如果只是尝试反对使用“本机”编译器的“外星人”构建感染 Mac(我将 brew 用于除了 clang 本身之外的所有内容)。
标签: c++ macos llvm homebrew clang++