Xcode 5.1 enable C++14

怎甘沉沦 提交于 2019-12-22 03:36:12

问题


Xcode 5.1 using Clang 3.4. And Clang 3.4 supports C++14.

However, I've been surfing though all of the Xcode options and don't see a way to enable C++14.

I'm trying to enable the relaxed constexpr feature of C++14


回答1:


To get this to work, you first set "C++ Language Dialect" to "compiler default". Then in "Other C++ flags" add "-std=c++1y".

This will allow Clang++ to compile with c++14 from within Xcode. I tested this with Xcode 5.1.1 using the new user defined literal for basic_string:

std::string word = "hello"s;

Update: As of Xcode 6, c++14 is available as a first-class language dialect.




回答2:


With Xcode Version 8.2 (8C38) you click on the project name in the project navigator (click on the little folder at the left of the window to get to this) then in the middle pane of the ide, you click on build settings (up the top of the middle pane), then you can scroll to find the Apple LLVM 8.0 - Language - C++ section. There is a C++ Language Dialect section; select C++14 [-std-c++=14] from the spinner. This then compiles properly.



来源:https://stackoverflow.com/questions/22952314/xcode-5-1-enable-c14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!