Osx Lion:Xcode 4.1如何设置C ++ 0x项目 [英] Osx Lion: Xcode 4.1 how do I setup a c++0x project
问题描述
I know there have been other questions like that but (i.e. Can I use C++11 with Xcode?) but mostly related to older versions of Osx or xcode so they don't really seem to be the right solution to go on Osx Lion and xcode 4.1. What are the requirements on osx Lion to use c++0x features? I think i'd have to set LLVM 3.0 as the compiler somehow using the new libc++ as the standard library. Is there a default way to get LLVM 3.0 to work on lion?
编辑:好的,直到LLVM 3.0成为xcode 4的一部分似乎只是时间问题: http://oleb.net /blog/2011/07/whats-new-for-developers-in-lion-part-1/
Edit: Okay it seems its just a matter of time till LLVM 3.0 will become part of xcode 4: http://oleb.net/blog/2011/07/whats-new-for-developers-in-lion-part-1/
推荐答案
在Xcode 4.1中,您可以使用其他"标志来访问对编译器的C ++ 0x支持,例如(实际上,我不是确定目前处于什么水平,我现在无法检查).最新版本的clang比Xcode 4.1随附的版本具有更好的支持. Xcode 4.2应该具有更新的编译器,并添加了语言和库选择选项.
In Xcode 4.1 you can use the 'other' flags to get access to the compiler's C++0x support, such as it is (Actually I'm not sure what level it's at right now, and I can't check it right now). The latest version of clang have much better support than the version that was shipped with Xcode 4.1. Xcode 4.2 should have the updated compiler and added language and library selection options.
因此,要在Xcode 4.1中获得C ++ 0x支持,请将标志-std = c ++ 0x -stdlib = libc ++添加到编译器,将-stdlib = libc ++添加到链接器.您可能还需要在编译器上使用-U__STRICT_ANSI__(显然,如果定义了 _ _STRICT_ANSI_ _ ,它将触发系统头文件中的错误).
So, to get C++0x support in Xcode 4.1 add the flags -std=c++0x -stdlib=libc++ to the compiler and -stdlib=libc++ to the linker. You might also need -U__STRICT_ANSI__ on the compiler (apparently if __STRICT_ANSI__ is defined it triggers a bug in the system headers).
这篇关于Osx Lion:Xcode 4.1如何设置C ++ 0x项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!