Xcode compiler cannot find C ++ 11 includes

I developed several classes in Visual Studio 2012 that actively use the features of C ++ 11, and also use new std functions, such as streams and mutexes. The reason was platform independence. Trying to move the code to OSX, the Xcode 5.0 compiler cannot open, it includes:

#include <chrono>
#include <thread>
#include <functional>
#include <mutex> 

I already switch the build options to C ++ 11 and was looking for the usr / include path for inclusions. Please do not offer a promotion because I am trying to exclude it from my projects.

+4
source share
2 answers

You need both -std=c++11, and -stdlib=libc++:

$ cat cpptest.cpp
#include <chrono>
#include <thread>
#include <functional>
#include <mutex>

int main() {
    return 0;
}

$ clang -o cpptest -std=c++11 -stdlib=libc++ cpptest.cpp
$ echo $?
0
+5
source

, Xcode, clang /usr/include, IDE. , β†’ ++ ++ 11 ++ lib++ ( LLVM ++ ++ 11)

+5

All Articles