Cocos2d-x-3.8.1 target to android get error : undefined reference to cocos2d LuaEngine getInstance()


#1

Hi everybody! I try to build my project that used c++ to load lua and get error: undefined reference to 'cocos2d::LuaEngine::getInstance() .I don’t know why . Help me please !. This is my android.mk

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d)
$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d/external)
$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d/cocos)
$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d/external/lua/lua)
$(call import-add-path,$(LOCAL_PATH)/…/…/cocos2d/external/lua/tolua)

LOCAL_MODULE := cocos2dcpp_shared

LOCAL_MODULE_FILENAME := libcocos2dcpp

LOCAL_SRC_FILES := hellocpp/main.cpp
…/…/Classes/AppDelegate.cpp
…/…/Classes/HelloWorldScene.cpp

LOCAL_C_INCLUDES := $(LOCAL_PATH)/…/…/Classes
LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/cocos2d/cocos
LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/cocos2d/cocos/scripting/lua-bindings/manual
LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/cocos2d/cocos/scripting/lua-bindings/auto
LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/cocos2d/external/lua/lua
LOCAL_C_INCLUDES += $(LOCAL_PATH)/…/…/cocos2d/external/lua/tolua

_COCOS_HEADER_ANDROID_BEGIN

_COCOS_HEADER_ANDROID_END

LOCAL_STATIC_LIBRARIES := cocos2dx_static
LOCAL_STATIC_LIBRARIES += cocos_lua_static
LOCAL_STATIC_LIBRARIES += luajit_static

_COCOS_LIB_ANDROID_BEGIN

_COCOS_LIB_ANDROID_END

include $(BUILD_SHARED_LIBRARY)

$(call import-module,.)
$(call import-module,extensions)
$(call import-module,scripting/lua-bindings/proj.android)

_COCOS_LIB_IMPORT_ANDROID_BEGIN

_COCOS_LIB_IMPORT_ANDROID_END


#2

sorry, mistake of me, I forgot to compile lua-binding and local_path


#3

Hello
I actually want to add Lua to my C++ project . And I did All the steps I could and it ended up having the same problem as you. Seems like you’ve been successful to run the project but I really do not understand what exactly you did to run the project. What do you mean by forgetting to compile lua_bindings ??? How did you compile it ?


#4

look at the project lua tests and copy their project settings in the android.mk file