Game World!

Join A World Of Gamers

Enter your email address:

Delivered by FeedBurner

Followers

Popular Posts

Friday, 2 July 2021

Does Xcode support C ++ 14?

 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

  • This question appears to be off-topic because it is about finding a button in an IDE. – stefan Apr 9 '14 at 14:39
  • 7
    And that is a problem, why?. The whole world does not revolve around a command line (in fact very little of it does) – Troy Harvey Apr 9 '14 at 15:54
  • 2
    There is an Xcode tag here with 5200 followers. Why would you think an Xcode-related question is not appropriate on stackoverflow? – jbruni Apr 11 '14 at 17:25
  • 2
    Programming is not only about algorithms, it involves a wide range of problem solving. – Zsolt Szatmari Aug 7 '14 at 21:13
19

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.

  • 5
    I'm sorry; I'm new to Xcode, but where in the world do you set "C++ Language Dialect" ??? – Nick Desaulniers Jan 3 '15 at 0:13
  • 3
    @NickDesaulniers You've probably found it by now but... click on your project in the Project Navigator (on the left by default), you should see a configuration sheet with titles Architectures, Build Locations, Build Options, etc. Scroll down quite a bit. You should see "Apple LLVM 6.0 - Language - C++". Also, take notice of above "Basic | All | Combined | Levels | +": you can apply the settings to the Project or the Target. – Olson.dev Jan 21 '15 at 10:28
  • @Olson.dev yes thank you. Disappointed to see XCode 5.1 only supports up to C++11, meaning I need to upgrade off of OSX 10.8.5 to use it. – Nick Desaulniers Jan 21 '15 at 16:36
0

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.

Floating Button

Button