cocos2dx编辑的时候,使用c++0x11标准

当运行安卓程序的时候,如果发现以下这种情况

jni/../../Classes/FXSharedMethod.cpp: In static member function 'static char* CFXSharedMethod::G2U(char const*)': 
jni/../../Classes/FXSharedMethod.cpp:15:32: error: 'CP_ACP' was not declared in this scope 
jni/../../Classes/FXSharedMethod.cpp:15:62: error: 'MultiByteToWideChar' was not declared in this scope 
jni/../../Classes/FXSharedMethod.cpp:19:28: error: 'CP_UTF8' was not declared in this scope 
jni/../../Classes/FXSharedMethod.cpp:19:69: error: 'WideCharToMultiByte' was not declared in this scope 
/cygdrive/D/android-ndk-r9d-windows-x86/android-ndk-r9d/build/core/build-binary.mk:393: recipe for target 'obj/local/armeabi/objs-debug/FX_shad 
make: *** [obj/local/armeabi/objs-debug/FX_shared/__/__/Classes/FXSharedMethod.o] Error 1 

原因是:使用了不支持c++的库。

解决方法如下:


(基于cocos2dx 2.2.2)现在下载的cygwin自带的gcc编译器的版本是4.8.x了,也就是全面支持c++0x11版本了。(我用的vs2013也已经大部分支持C++0x11的版本)。但是默认情况下,gcc是不支持的,需要在编译选项设置开关。

我们用文本编辑器打开proj.android\jni\Application.mk,并增加 -std=c++0x,这样就可以编译c++0x11的C++代码了。

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -DCC_ENABLE_CHIPMUNK_INTEGRATION=1 -DCOCOS2D_DEBUG=1 -std=c++0x


你可能感兴趣的:(cocos2dx编辑的时候,使用c++0x11标准)