Xcode编译器找不到C ++ 11包括 [英] Xcode compiler cannot find C++ 11 includes

查看:509
本文介绍了Xcode编译器找不到C ++ 11包括的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Visual Studio 2012中开发了一些类,它们大量使用C ++ 11特性,并且使用了新的std特性,如线程和互斥。原因是平台无关。试图将代码移植到OSX Xcode编译器5.0无法打开以下包括:

I developed some classes in Visual Studio 2012 which make heavy use of C++11 features and also uses new std features like threads and mutex. The reason was to be platform independent. Trying to port the code to OSX the Xcode compiler 5.0 cannot open following includes:

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

我已经将构建设置切换到C ++ 11并搜索usr / include路径include 。

I already switch the build settings to C++11 and searched the usr/include path for the includes. Please do not suggest boost as I try to eliminate it from my projects.

推荐答案

您需要两个 - std = c ++ 11 -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

这篇关于Xcode编译器找不到C ++ 11包括的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆