0

我有一堆C带有扩展名.c.h. 我想用Android NDK. 当我尝试仅使用一个文件时,NDK效果很好,但是当我尝试使用包含在此主C文件中包含其他文件时,出现错误。我错过了什么?这是我的Android.mk文件:

LOCAL_PATH := $(call my-dir)

include $(CLEAR_VARS)

LOCAL_LDLIBS := -llog

LOCAL_MODULE    := ndksetupdemo
LOCAL_SRC_FILES := mymain_c_file.c
 LOCAL_C_INCLUDES := includes 
include $(BUILD_SHARED_LIBRARY)

我应该包括更多吗?

4

1 回答 1

0

It appears that you only link against the log library (LOCAL_LDLIBS := -llog). If you are referencing functions that are not defined in any of the included headers and in your mymain_c_file.c, you will get the undefined reference error. You will need to find out what other libraries you need to link against and list them in LOCAL_LDLIBS.

If the functions are defined in the other .c files, you need to add them to the LOCAL_SRC_FILES variable.

于 2012-04-16T04:48:46.930 回答