开发者

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开发者_如何学Go 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?

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/


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.

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).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜