ios集成protobuf之后,调用pro.android/build_native.sh 生成android工程的时候会出现
jni/../../Classes/AppDelegate.cpp:125: error: undefined reference to 'luaopen_protobuf_c'
clang++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [obj/local/armeabi/libcocos2dlua.so] Error 1
这时要修改 Android.mk文件,
define copy-pbc-file-name
$(patsubst jni/%,%, $(shell find $(LOCAL_PATH)/../../Classes/pbc $(LOCAL_PATH)/../../Classes/binding/lua -name "*.c"))
endef
LOCAL_SRC_FILES := hellolua/main.cpp \
../../Classes/VisibleRect.cpp \
../../Classes/AppDelegate.cpp \
../../Classes/ConfigParser.cpp \
$(call copy-pbc-file-name)
LOCAL_C_INCLUDES := \
$(LOCAL_PATH)/../../Classes/runtime \
$(LOCAL_PATH)/../../Classes \
$(COCOS2DX_ROOT)/external \
$(COCOS2DX_ROOT)/external/protobuf-lite/src \
$(LOCAL_PATH)/../../Classes/quick-src \
$(LOCAL_PATH)/../../Classes/quick-src/extra \
$(LOCAL_PATH)/../../Classes/pbc
之后成功调用 pro.android/build_native.sh 生成android工程
[armeabi] Install : libcocos2dlua.so => libs/armeabi/libcocos2dlua.so
来源:oschina
链接:https://my.oschina.net/u/1582495/blog/500270