我在jni文件夹中有这些文件:
Android.mk
Application.mk
m_lanczos.c
m_lanczos.h
sresolution.cpp
我只想在resolution.cpp中使用我的库,如:
#include"m_lanczos.h"
我还需要在Android.mk中添加什么?谢谢!
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := super
LOCAL_SRC_FILES := sresolution.cpp
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
答案 0 :(得分:1)
有两件事可能是错的:
您忘了编译m_lanczos.c:
那你的Android.mk应该是这样的:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := super
LOCAL_SRC_FILES := sresolution.cpp m_lanczos.c
LOCAL_LDLIBS += -llog -ldl
include $(BUILD_SHARED_LIBRARY)
m_lanczos是STATIC_LIBRARY:
然后你必须构建它并包含它:
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := m_lanczos
LOCAL_SRC_FILES := m_lanczos.c
LOCAL_LDLIBS += #needed librarys for m_lanczos, probably nothing
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := super
LOCAL_SRC_FILES := sresolution.cpp
LOCAL_LDLIBS += -llog -ldl
LOCAL_STATIC_LIBRARIES := m_lanczos
include $(BUILD_SHARED_LIBRARY)
但我认为这将是第一个, 我希望我帮助:)。