Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to use std::make_unique in Xcode 5.1?

Tags:

c++

std

xcode

c++14

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?

like image 565
Kevin MOLCARD Avatar asked Mar 24 '14 14:03

Kevin MOLCARD


1 Answers

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"

like image 153
Mankarse Avatar answered Oct 20 '22 00:10

Mankarse