Android ndk未定义引用错误

Android ndk未定义引用错误,android,c++,android-ndk,Android,C++,Android Ndk,我有一个C++源文件,我想从C++文件中调用一个方法,但我不知道出了什么问题。 以下是我的cpp方法: static unsigned ALawEncode(uint8_t* dst, int16_t* src, size_t srcSize); 我想在这里调用我的方法: #include <string.h> #include <jni.h> #include <stdint.h> #include "G711.h" extern "C" {

我有一个
C++
源文件,我想从
C++
文件中调用一个方法,但我不知道出了什么问题。 以下是我的cpp方法:

static unsigned ALawEncode(uint8_t* dst, int16_t* src, size_t srcSize);
我想在这里调用我的方法:

#include <string.h>
#include <jni.h>
#include <stdint.h>
#include "G711.h"

extern "C" {

    uint8_t* Java_com_example_qonclient_Codecs_encodeG711( JNIEnv* env, jobject thiz, int16_t* source ){

        size_t size0 = sizeof(source);
        G711 g711;
        uint8_t *dst;

        g711.ALawEncode(dst, source, size0);

        return dst;
    }

}
#包括
#包括
#包括
#包括“G711.h”
外部“C”{
uint8_t*Java_com_示例_qonclient_Codecs_encodeG711(JNIEnv*env、jobject thiz、int16_t*source){
size\u t size0=sizeof(来源);
G711 G711;
uint8_t*dst;
g711.ALawEncode(dst,来源,尺寸0);
返回dst;
}
}

你能帮我吗

您必须将方法定义合并到编译过程中,或者从源代码中构建一个库,然后将其链接起来。谢谢,但是怎么做呢?抱歉,但这是我第一次使用ndk…为什么你认为有问题?你收到错误信息了吗?什么消息?顺便说一句,您的
com.example.qonclient.Codecs.encodeG711()
方法无法发送或接收C指针;它必须使用Java字节[]。您应该使用JNI函数(例如)将Java数组转换为C数组,反之亦然。