6

Since Xcode 5.1 includes clang 3.4, it should be possible to use std::make_unique. It seems to be defined in memory.h.

However, it needs to have _LIBCPP_STD_VER > 11 but it is still set to 11 because of the value of __cplusplus macro (still 201103L).

Is there a way to change this?

0
12

As specified in the clang website, you need to enable -std=c++1y.

Xcode does not include this option as a choice in its "C++ Language Version" option, so you will need to manually enter it. To do this, you need to go into the "Editor" menu while the project definition is open and press "Show Definitions". You should now be able to manually change the "C++ Language Dialect" option to c++1y:

Enabling "Show Definitions"

3
  • 1
    In Xcode 6.2, I had to use GNU++14[-std=gnu++14] to get this to work. If you select your project, you can access these settings. In 6.2, there is no ui as show above (Editor> Show Definitions). – Tim Elhajj Apr 5 '15 at 6:25
  • @TimElhajj: Thanks for the update. Unfortunately I don't have access to an OSX machine any more; so I can't provide a new screenshot. Feel free to add your own answer. – Mankarse Apr 5 '15 at 6:28
  • 1
    I could add an answer with information for 6.2, but it wouldn't really apply to this specific question. I added my note because this was the first google result for make_unique and Xcode. Hopefully it's enough to get anyone else who Googles on the right track – Tim Elhajj Apr 5 '15 at 22:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.