LLVM& Clang支持C ++ 11 [英] LLVM&Clang support of C++11

查看:153
本文介绍了LLVM& Clang支持C ++ 11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一些代码写我的MS VC ++ 10。我使用C ++ 11,特别是像

I have some code written by me for MS VC++10. I use C++11 and, in particular, expressions like

std::function<int (int)> f =...;
auto it = v.begin();
for_each(it1, it2,[&](int& i) { ++i;}); 

现在我使用llvm& clang尝试MacOS和XCode,我的代码不能编译!问题是为什么?也许,我将指定一个选项使用c ++ 11。在这种情况下,我在哪里可以解决它在xcode?

Now I'm trying out MacOS and XCode with llvm&clang and my code can't be compiled! The question is why? Perhaps, I shall specify an option to use c++11. In this case, where can I fix it in xcode?

推荐答案

你需要Xcode 4.2。

You will need Xcode 4.2.

在构建设置中,搜索c ++ 0x并将C ++语言方言设置为C ++ 0x [-std = c ++ 0x]。然后搜索libc ++并将C ++标准库设置为libc ++。

In your build settings, search for "c++0x" and set the "C++ Language Dialect to C++0x [-std=c++0x]". Then search for "libc++" and set the "C++ Standard Library" to "libc++".

并非所有C ++ 11设备都可用。例如,不支持lambdas。

Not all C++11 facilities are available. For example lambdas are not yet supported.

这篇关于LLVM&amp; Clang支持C ++ 11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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