cocos2d-x在NDK r9下的编译问题

时间:2022-04-10 16:07:30

Compile++ thumb  : cocos2dx_static <= CCCommon.cpp E:/cocos2d-x-2.x/cocos2d-x-2.1.4/projects/T3/proj.android/../../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLog(char const*, ...)':

E:/cocos2d-x-2.x/cocos2d-x-2.1.4/projects/T3/proj.android/../../../cocos2dx/platform/android/CCCommon.cpp:44:72: error: format not a string literal and no format arguments [-Werror=format-security]

E:/cocos2d-x-2.x/cocos2d-x-2.1.4/projects/T3/proj.android/../../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLuaLog(char const*)':

E:/cocos2d-x-2.x/cocos2d-x-2.1.4/projects/T3/proj.android/../../../cocos2dx/platform/android/CCCommon.cpp:54:77: error: format not a string literal and no format arguments [-Werror=format-security]

cc1plus.exe: some warnings being treated as errors

make: *** [obj/local/armeabi/objs/cocos2dx_static/platform/android/CCCommon.o] Error 1 /cygdrive/e/android/android-ndk-r9/build/core/build-binary.mk:348: recipe for target 'obj/local/armeabi/objs/cocos2dx_static/platform/android/CCCommon.o' failed

 

如果控制台输入了以上的错误信息,最好将NDK换回r8e版本
或者
Application.mk里面添加下面代码

APP_CPPFLAGS += -Wno-error=format-security