cocos2dX 2.0 lua to Android error

cocos2dX 2.0 lua to Android error
0.0 0


Hello,everyone.When I had write a project,and I had run success at Xcode.Now I want to remove it to android. So I do this

  1. remove the $COCOS2D_ROOT/lua/ to myproject/libs/lua
  2. Change the to this

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared



LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dx_static cocosdenshion_static cocos_lua_static


LOCAL_SRC_FILES := helloworld/main.cpp …/…/Classes/AppDelegate.cpp

$(call import-module,CocosDenshion/android) $(call import-module,cocos2dx) $(call import-module,lua/

And the error msg is

StaticLibrary : liblua.a
SharedLibrary :
./obj/local/armeabi/libcocos2d.a(CCConfiguration.o): In function `cocos2d::CCConfiguration::init()‘:
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65: undefined reference to `std::allocator::allocator()’
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65: undefined reference to `std::basic_string<char, std::char_traits, std::allocator >::basic_string(char const*, std::allocator const&)‘
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65: undefined reference to `std::basic_string<char, std::char_traits, std::allocator >::basic_string’
/Users/zhaozhongjian/Documents/tools/cocos2d-2/cocos2dx/CCConfiguration.cpp:65:\ undefined\ reference\ to\ `std::allocator::

and so on.
I do not know how solve it.Help me ,thank you.

屏幕快照 2012-07-19 上午10.41.53.png (37.8 KB)

屏幕快照 2012-07-19 上午10.41.53.png (37.8 KB)


Can someone help me? Thank you.




额 那我也用汉语吧 英语也实在太垃圾了。。。

LOCAL_C_INCLUDES 还要包含哪些头文件呢? lua 我个人感觉应该是作为一个库文件打包进去了。。所以任何文件都没引。。望您在详细的解释下。。菜鸟一个 呵呵 谢谢。


Hello,Anyone. Help.


What’s the content of
The content should be

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti


Minggo Zhang
Yes.My’s content is that.
And I had success build the HelloLua to the Android. Then I copy the folder to my project. But failed.
Then I copy the content of the jin/ to mine.But it failed,again.
Can you help me?


Hello everyone, Help me.
My looks like this

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_MODULE := game_shared


LOCAL_WHOLE_STATIC_LIBRARIES = cocosdenshion_static
= cocos_lua_static


LOCAL_SRC_FILES := helloworld/main.cpp …/…/Classes/AppDelegate.cpp …/…/…/lua/cocos2dx_support/CCLuaEngine.cpp …/…/…/lua/cocos2dx_support/Cocos2dxLuaLoader.cpp …/…/…/lua/cocos2dx_support/LuaCocos2d.cpp …/…/…/lua/cocos2dx_support/tolua_fix.c


$(call import-module,cocos2dx)
$(call import-module,CocosDenshion/android)
$(call import-module,lua/

and my looks like this

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti

and the error message is also the same.

Can someone help me?


Please use or create-android-project.bat to create a new android project.
More information please refer [[How to create android project with script]].


Yes,I create the project use the script.


Could you paste .cpp files to reproduce it?


My step is that:

  1. create an Android project by script.
    2.copy the folder , platform folder, cocos2d/ , cocosDesion/android folder, lua/ folder to my project
    3.change the
    4.change the file. copy the HelloLua/jni/ to my project.


Sorry, I do not understand you. Which .cpp file?


Could you paste a demo project to reproduce it?
Or you can send a zip file to me.


OK,Thank you. I will send your the zip file.


try delete .o files.
it’s under\obj\local\armeabi