Clang 3.1和C ++ 11支持状态 [英] Clang 3.1 and C++11 support status
问题描述
从clang的C ++ 11支持状态网站, http://clang.llvm.org/cxx_status.html ,它说,初始化列表和Lambda表达式都支持从版本3.1开始。
From clang's C++11 support status website, http://clang.llvm.org/cxx_status.html , it says, "Initializer List" and "Lambda Expression" are all supported starting from version 3.1.
但是,使用LLVM /列表和lambda表达式将产生错误消息。
However, using LLVM/Clang trunk (3.2), compiling against initializer list and lambda expression will yield error messages.
有人知道Clang> 3.1是否支持这些功能?
Does anyone know if Clang >3.1 supports those features?
推荐答案
默认情况下, clang ++
不会启用C ++ 11的功能 - 你有在编译期间传递额外的旗标。
By default, clang++
will not enable the C++11 features - you have to pass an additional flag during compilation.
clang++ -std=c++11 [input files...]
或
# enables some additional C++11 extensions GCC has
clang++ -std=gnu++11 [input files...]
此外,您可以使用 libstdc ++
自己的 libc ++
,这是C ++标准库的不同实现。 libc ++
在某些情况下可能比现有的 libstdc ++
库更好地实现C ++ 11标准。 p>
Additionally, you can switch between using libstdc++
and Clang's own libc++
, which are different implementations of the C++ standard library. libc++
in some cases might have a better implementation of the C++11 standard than your existing libstdc++
library.
# uses clang's C++ library in C++98 mode
clang++ -stdlib=libc++ [input] # uses clang's C++ library
# uses clang's C++ library and enables C++11 mode
clang++ -stdlib=libc++ -std=c++11 [input]
如果您在使用过期版本 libstdc ++
的环境中使用Clang, (像Mac OSX),但是请注意,这两个C ++库彼此不兼容,所以如果你使用它,你必须重建任何依赖对 libc ++
。
The latter is important if you're using Clang in an environment with an outdated version of libstdc++
(like Mac OSX), but note that the two C++ libraries are not compatible with each other, so you would have to rebuild any dependencies against libc++
if you were to use that.
这篇关于Clang 3.1和C ++ 11支持状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!