Xcode 4.3 and C++11 include paths

前端 未结 2 662
余生分开走
余生分开走 2020-12-07 23:06

I installed Xcode 4.3 and want to test this C++11 program:

#include 

int main()
{
}

However, it doesn\'t find the

相关标签:
2条回答
  • 2020-12-07 23:31

    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)"
    0 讨论(0)
  • 2020-12-07 23:42

    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.

    0 讨论(0)
提交回复
热议问题