2

我在 jni 文件夹中有这些文件:

  • 安卓.mk

  • 应用程序.mk

  • m_lanczos.c

  • m_lanczos.h

  • 分辨率.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)
4

1 回答 1

1

有两件事可能是错误的:

  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)  
    
  2. 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)
    

但我认为这将是第一个,我希望我有所帮助:)

于 2013-01-14T16:49:19.803 回答