I am relatively new to C
I am working to port Chipmunk physics engine into my project, however, when I try to run ndk-build I get the following...
/Users/user/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/chipmunk_shared/src/cpSpace.o: in function cpSpaceInit:jni/src/cpSpace.c:103: error: undefined reference to 'cpBBTreeNew' /Users/user/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/chipmunk_shared/src/cpSpace.o: in function cpSpaceInit:jni/src/cpSpace.c:104: error: undefined reference to 'cpBBTreeNew' /Users/user/Development/Android/android-ndk-r8c/toolchains/arm-linux-androideabi-4.6/prebuilt/darwin-x86/bin/../lib/gcc/arm-linux-androideabi/4.6/../../../../arm-linux-androideabi/bin/ld: ./obj/local/armeabi/objs/chipmunk_shared/src/cpSpace.o: in function cpSpaceInit:jni/src/cpSpace.c:105: error: undefined reference to 'cpBBTreeSetVelocityFunc'
When I grep for that class I see...
~/Documents/workspace/Chipmunk$ grep -r cpBBTreeNew jni/ jni//include/chipmunk/cpSpatialIndex.h:cpSpatialIndex* cpBBTreeNew(cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex); jni//src/cpBBTree.c:cpBBTreeNew(cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex) jni//src/cpSpace.c: space->staticShapes = cpBBTreeNew((cpSpatialIndexBBFunc)cpShapeGetBB, NULL); jni//src/cpSpace.c: space->activeShapes = cpBBTreeNew((cpSpatialIndexBBFunc)cpShapeGetBB, space->staticShapes);
So I know the .h file is there and I confirmed it was getting loaded through another .h class. I don't think this is the issue but here is my Android.mk...
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := chipmunk_shared
LOCAL_MODULE_FILENAME := libchipmunk
LOCAL_SRC_FILES := \
src/chipmunk.c \
....
src/cpVect.c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
LOCAL_CFLAGS := -std=c99
include $(BUILD_SHARED_LIBRARY)
########### Static library
include $(CLEAR_VARS)
LOCAL_MODULE := chipmunk_static
LOCAL_MODULE_FILENAME := libchipmunk
LOCAL_SRC_FILES := \
src/chipmunk.c \
....
src/cpVect.c
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/chipmunk
LOCAL_CFLAGS := -std=c99
include $(BUILD_STATIC_LIBRARY)
Can anyone help?