jni中的错误链接器

时间:2013-12-30 16:09:24

标签: android java-native-interface native

我正在为Android做本机应用程序,我可以为我的应用程序添加本机支持。但是当我想添加Siglib(我在c ++代码中使用的DSP库)代码时:

fatal error: siglib.h: No such file or directory

我的配置是:

enter image description here

我认为可以,因为我添加了包含siglib路径。

我的代码:

Application.mk

APP_STL := gnustl_static
APP_CPPFLAGS := -frtti -fexceptions
APP_STL := stlport_static
APP_ABI := armeabi
APP_PLATFORM := android-8

Android.mk

LOCAL_PATH:= $(致电my-dir)

include $(CLEAR_VARS)



LOCAL_SRC_FILES  := nativo.cpp Parameters.cpp
LOCAL_C_INCLUDES += $(LOCAL_PATH)
LOCAL_LDLIBS     += -llog -ldl

LOCAL_MODULE     := native_code

include $(BUILD_SHARED_LIBRARY)

nativo.h

/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class com_sistoleaudiocapture_Processing */

#ifndef _Included_com_sistoleaudiocapture_Processing
#define _Included_com_sistoleaudiocapture_Processing
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     com_sistoleaudiocapture_Processing
 * Method:    init_variables
 * Signature: ()J
 */
JNIEXPORT jlong JNICALL Java_com_sistoleaudiocapture_Processing_init_1variables
  (JNIEnv *, jclass);

/*
 * Class:     com_sistoleaudiocapture_Processing
 * Method:    prueba_nativa
 * Signature: (J)V
 */
JNIEXPORT jdouble JNICALL Java_com_sistoleaudiocapture_Processing_prueba_1nativa
  (JNIEnv *, jclass, jlong);

#ifdef __cplusplus
}
#endif
#endif

和nativo.cpp

#include "nativo.h"
#include "Parameters.h"
#include <siglib.h>

#include <android/log.h>

#define LOG_TAG "NATIVO"
#define LOGD(...) ((void)__android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__))

JNIEXPORT jlong JNICALL Java_com_sistoleaudiocapture_Processing_init_1variables(
        JNIEnv *, jclass) {

    long dir = (long) new Parameters();

    return (dir);
}

JNIEXPORT jdouble JNICALL Java_com_sistoleaudiocapture_Processing_prueba_1nativa(
        JNIEnv *, jclass, jlong retorno) {
}

帮助?感谢?

1 个答案:

答案 0 :(得分:1)

您只告诉Eclipse在哪里寻找 siglib.h ,请在 Android.mk

中添加LOCAL_C_INCLUDES的路径