Cocos2d-x vs. C++11

Cocos2d-x vs. C++11
0.0 0


Do C11 and Cocos2d-x get along?
I am wondering if it is safe to use “C++11[-std=c++11]” as “C++ Language Dialect” in my Cocos2d-x project.
I set it in Xcode and it compiles without any errors, but I’ve read that there could be potential problems with Visual Studio and the Android NDK. Are those concerns valid?
Also, I tried setting the “C++ Standard Library” to “libc++ (LLVM C++ standard library with C++11 support)” but the compiler gives me an error, stating:
clang: error: invalid deployment target for -stdlib=libc++ (requires OS X 10.7 or later)
Is there a way to use the C
11 std library in Cocos2d-x projects?


Recent MSVC and GCC 4.6 (used in android NDK by default) both have good support for C*+ 2011. Here is a table of particular features:
I successfully used libc*+ on iOS, so there are no problem too. Probably issue is in your project settings, check which OS X or iOS SDK used.


Thanks for the answer Sergey

You were right, the project settings were targeting OS X 10.6 and setting those to 10.7 removed the invalid deployment target error.
I am now receiving a good bunch of bugs (in attachment). I’ll check to see how to resolve those.



I am using cocos2d-x as a static library.
I had to use the same std library and c++11 dialect in the static library to successfully compile the project.


Btw, you can use my c++11 extensions:


Awesome, I’ll have a look


In addition, if you’re on win32 and using Visual Studio, you may want to try using the “Visual C*+ Compiler November 2012 CTP”, from . It’s a version of the visual c*+ compiler with additional support for c++11 stuff. It’s pretty useful



Great stuff! Yes, I am actually. Targeting primarily OSX, Win32 and Linux. That comes in really handy!