Cocos2dx开发解决编译安卓的19Level SDK下undefined reference to 'atof'

前端之家收集整理的这篇文章主要介绍了Cocos2dx开发解决编译安卓的19Level SDK下undefined reference to 'atof'前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

在cocos creator上编译安卓App的时候,在21 level下没问题,但19 level下回报如下错误

  1. xxx/proj.android/../cocos2d/cocos/./platform/CCFileUtils.cpp:277:error:undefinedreferenceto'atof'
  2. xxx/proj.android/../cocos2d/cocos/./platform/CCFileUtils.cpp:286:error:undefinedreferenceto'atof'
  3. xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1224:error:undefinedreferenceto'srand'
  4. xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1225:error:undefinedreferenceto'rand'
  5. xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1253:error:undefinedreferenceto'srand'
  6. xxx/proj.android/../cocos2d/cocos/./base/CCConsole.cpp:1254:error:undefinedreferenceto'rand'
  7. xxx/proj.android/../cocos2d/cocos/./base/ccUtils.cpp:254:error:undefinedreferenceto'atof'
  8. xxx/proj.android/../cocos2d/cocos/./base/ccRandom.h:117:error:undefinedreferenceto'rand'
  9. xxx/Pickle/proj.android/../cocos2d/cocos/./base/ccRandom.h:117:error:undefinedreferenceto'rand'
  10. xxx/proj.android/../cocos2d/cocos/./2d/CCActionTiledGrid.cpp:280:error:undefinedreferenceto'srand'
  11. xxx/proj.android/../cocos2d/cocos/./2d/CCActionTiledGrid.cpp:605:error:undefinedreferenceto'srand'

解决办法:

修改proj.android/jni/Application.mk文件增加如下一行代码

APP_PLATFORM := android-19

再重新编译就ok了,这样不管是编译x86的,还是arm得,还是armv7的就都不报错了。

原文链接:https://www.f2er.com/cocos2dx/338303.html

猜你在找的Cocos2d-x相关文章