1

我对 C 比较陌生

我正在努力将 Chipmunk 物理引擎移植到我的项目中,但是,当我尝试运行 ndk-build 时,我得到以下...

/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: 在函数 cpSpaceInit:jni/src/cpSpace.c: 103:错误:未定义引用'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: 在函数中cpSpaceInit:jni/src/cpSpace.c:104:错误:未定义对“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: 在函数 cpSpaceInit:jni/src/cpSpace.c:105: 错误: 未定义引用'cpBBTreeSetVelocityFunc '

当我为那门课做 grep 时,我看到...

~/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: 空间->staticShapes = cpBBTreeNew((cpSpatialIndexBBFunc)cpShapeGetBB, NULL); jni//src/cpSpace.c: 空间->activeShapes = cpBBTreeNew((cpSpatialIndexBBFunc)cpShapeGetBB, 空间->staticShapes);

所以我知道 .h 文件在那里,我确认它是通过另一个 .h 类加载的。我不认为这是问题,但这是我的 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)

任何人都可以帮忙吗?

4

1 回答 1

2

链接时听起来好像缺少 cpBBTree.o。LOCAL_SRC_FILES 中是否缺少 cpBBTree.c?

于 2013-01-24T19:21:55.103 回答