我能够在Linux上更新gcc以获得-std = c ++ 17,但在Mac上却无法做到这一点.是否有我可以更新到的Clang版本或在Mac上获得C ++ 17的其他替代版本?请帮忙.谢谢.
I am able to update gcc on Linux to get -std=c++17 but cannot do the same on Mac. Is there a version of Clang I can update to or some other alternative to get C++17 on my Mac? Please help. Thanks.
推荐答案在我的10.11 El Capitan Xcode 7.3.1上,c已更新为:
On my 10.11 El Capitan, Xcode 7.3.1, clang has been updated to:
Apple LLVM version 7.3.0 (clang-703.0.31)几乎等同于llvm 3.8版. clang++没有-std=c++17选项,但是-std=c++1z目前运行良好,尽管它仅支持C ++ 1z的某些功能.
which is almost equivalent to llvm version 3.8. clang++ hasn't -std=c++17 option, but -std=c++1z, working well at present, though only supporting some features of C++1z.
对于gcc,您可以通过以下方式安装一个非常新的版本:
For gcc, you can install a very new one by:
brew install gcc --HEAD它将立即安装gcc-6.1(2016.8).此gcc对C ++ 17的支持有限,可以通过-std=c++17启用.
which will install gcc-6.1 now, (2016.8). This gcc has limited support for C++17 and can be enabled by -std=c++17.
一些更新:
Apple clang的对应llvm版本最近不清楚,应为3.9+或4+.查看此Wiki页面以获取更多信息.
The corresponding llvm version of Apple's clang is not clear recently, should be 3.9+ or 4+. Check this wiki page for more information.
brew install gcc --HEAD应该始终适用于mac/homebrew,并为您提供具有许多实验功能的尖端gnu gcc.另一方面,普通brew install gcc现在应该安装支持大多数c ++ 17功能的gcc.
brew install gcc --HEAD should always work for mac/homebrew, and give you the cutting edge gnu gcc with many experimental features. On the other hand, normal brew install gcc should install a gcc supporting most c++17 features now.
对于语言标准参数,对于不同的编译器请尝试-std=c++17和-std=c++1z,其中之一应该可以工作.
For the language standard argument, try -std=c++17 and -std=c++1z for different compilers, one of them should work.
更多推荐
如何在Mac上启用C ++ 17?
发布评论