Xcode 4.3 and C++11 include paths Xcode 4.3 and C++11 include paths xcode xcode

Xcode 4.3 and C++11 include paths


You need:

-std=c++0x

to select C++11. And you need:

-stdlib=libc++

to select libc++. By default, the std::lib that shipped with gcc 4.2 is used, which is pre-C++11.


Howard Hinnant's answer (with corrections) is the correct answer for the command line.

To use the new C++11 standard library inside of Xcode:

  • In the Build Settings tab for your project, scroll down to "Apple LLVM Compiler 4.1 - Language"
  • Set the setting "C++ Language Dialect" to "C++11 [-std=c++11]"
  • Set the setting "C++ Standard Library" to "libc++ (LLVM standard C++ library with C++11 support)"