Possible Duplicate:
Can I use C++11 with Xcode?
It seems like xcode 4 contains older versions of clang and gcc. Can i uppgrade gcc or clang and use them with xcode 4? I would like to use gcc >= 4.6 or the latest clang.
My main goal is to be able to have as much of the new features from C++11 available when programming C++ on mac osx lion so ditching xcode is also an option if that is needed.
What are my options to achieve this?
The version of clang in Xcode 4.1 does support some C++11 features, including variadic templates and rvalue references. Also libc++, an implementation of the C++11 standard library is included in Lion.
See my answer to Osx Lion: Xcode 4.1 how do I setup a c++0x project for details on setting this up.
Each version of Xcode 4 adds new compiler support features. Please try Xcode 4.2 when it comes out.
Macports provides GCC 4.6, but any GCC version >= 4.2.1 (ie the latest official Apple GCC) cannot create universal binaries (32 and 64-bit code in one file) directly. There may be other drawbacks, but otherwise this should work for you.
Consider using Clang++ with libc++ http://libcxx.llvm.org/
It supports Mac OS X and has about 98% C++0x features finished except atomics.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With