Apple llvm 9.0 cannot use C ++ 17 flag

When I try to use some C ++ 17 features, I create my code on the command line as follows:

llvm-g++ -std=c++17 main.cpp 

but it failed. I got:

error: invalid value 'c++17' in '-std=c++17'

version of my llvm-g ++:

[wjy@wjy-mba] cpp$ llvm-g++ -v
Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

and at the same time, I can create my code in Xcode (using C ++ 17). Xcode Settings

+4
source share
2 answers

-std=c++17was added to Clang 5.0.0 (released recently - earlier this month - see http://releases.llvm.org/5.0.0/tools/clang/docs/ReleaseNotes.html ).

https://en.wikipedia.org/wiki/Xcode#Latest_versions , , Xcode 9.0 LLVM/Clang 4.0. , .

+3

, -std = ++ 1z

+1

Source: https://habr.com/ru/post/1686027/


All Articles