[英]Cocos2d-x fails to compile C++ code in MacOs using ./build_native.sh
I'm using android-ndk-r9b and cocos2d-x-2.1.4 under MacOs Mavericks. 我在MacOs Mavericks下使用android-ndk-r9b和cocos2d-x-2.1.4。 I was able to create the android application for cocos2d-x, but when I tried to compile the C++ code using ./build_native.sh script, the compiler get me some warnings and at the end failed.
我能够为cocos2d-x创建android应用程序,但是当我尝试使用./build_native.sh脚本编译C ++代码时,编译器向我发出一些警告,但最终失败。
These warnings are: 这些警告是:
Android NDK: WARNING: APP_PLATFORM android-18 is larger than android:minSdkVersion 8 in ./AndroidManifest.xml
Android NDK: WARNING:/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/Android.mk:cocos2dx_static: LOCAL_LDLIBS is always ignored for static libraries
[armeabi] Compile thumb : cocos2dx_static <= quaternion.c
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/quaternion.c: In function 'kmQuaternionAssign':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/quaternion.c:478:5: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]
[armeabi] Compile thumb : cocos2dx_static <= vec4.c
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/vec4.c: In function 'kmVec4Assign':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/kazmath/src/vec4.c:150:5: warning: incompatible implicit declaration of built-in function 'memcpy' [enabled by default]
[armeabi] Compile++ thumb: cocos2dx_static <= CCCommon.cpp
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLog(char const*, ...)':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp:44:72: error: format not a string literal and no format arguments [-Werror=format-security]
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLuaLog(char const*)':
/Developer/cocos2d-x-2.1.4/samplecocos2dxandroid/proj.android/../../cocos2dx/platform/android/CCCommon.cpp:54:77: error: format not a string literal and no format arguments [-Werror=format-security]
cc1plus: some warnings being treated as errors
I'm wondering if someone has encounter similar errors, how how to revolve it? 我想知道是否有人遇到类似的错误,如何旋转?
Thanks! 谢谢!
Same problem here (Cocos2DX 2.1.1) 同样的问题在这里(Cocos2DX 2.1.1)
http://www.cocos2d-x.org/forums/6/topics/32437?r=39742#message-39742 http://www.cocos2d-x.org/forums/6/topics/32437?r=39742#message-39742
You can shut down the compiler error: 您可以关闭编译器错误:
in Application.mk: APP_CFLAGS += -Wno-error=format-security 在Application.mk中:APP_CFLAGS + = -Wno-error = format-security
or better, solve the problem of string format, in 4 points of cocos code (as you can see in the link above): 或者更好的方法是,用4点cocos代码解决字符串格式的问题(如您在上面的链接中所见):
1 - CCCommon.cpp - __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", buf); 1-CCCommon.cpp-__android_log_print(ANDROID_LOG_DEBUG,“ cocos2d-x调试信息”,buf); -> __android_log_print(ANDROID_LOG_DEBUG, "cocos2d-x debug info", "%s", buf);
-> __android_log_print(ANDROID_LOG_DEBUG,“ cocos2d-x调试信息”,“%s”,buf);
2 - SimpleAudioEngine.cpp - LOGD(deviceModel); 2-SimpleAudioEngine.cpp-LOGD(deviceModel); -> LOGD("%s",deviceModel);
-> LOGD(“%s”,deviceModel);
3 - OpenSLEngine.cpp - LOGD(errorInfo); 3-OpenSLEngine.cpp-LOGD(errorInfo); -> LOGD("%s",errorInfo);
-> LOGD(“%s”,errorInfo);
4 - SimpleAudioEngineOpenSL.cpp - LOGD(errorInfo); 4-SimpleAudioEngineOpenSL.cpp-LOGD(errorInfo); -> LOGD("%s",errorInfo);
-> LOGD(“%s”,errorInfo);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.