天天看點

cocos2dx 移植android 報錯

  1. jni/../../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLog(char const*, ...)':  
  2. jni/../../../cocos2dx/platform/android/CCCommon.cpp:44:72: error: format not a string literal and no format arguments [-Werror=format-security]  
  3. jni/../../../cocos2dx/platform/android/CCCommon.cpp: In function 'void cocos2d::CCLuaLog(char const*)':  
  4. jni/../../../cocos2dx/platform/android/CCCommon.cpp:54:77: error: format not a string literal and no format arguments [-Werror=format-security]  
  5. cc1plus: some warnings being treated as errors  
  6. make: *** [obj/local/armeabi/objs/cocos2dx_static/platform/android/CCCommon.o] Error 1  

方法1:如果控制台輸入了以上的錯誤資訊,最好将NDK換回r8e版本。github上已經有人修複了這個問題

方法2:在Application.mk裡面添加下面代碼

APP_CPPFLAGS += -Wno-error=format-security

官網已經有人解決了

[html]  view plain copy

  1. http://cocos2d-x.org/boards/6/topics/33525?r=33579#message-33579