0

我正在尝试使用 Android NDK 编译 Soundtouch 库。我成功安装了 Soundtouch 库所需的 Cygwin 和 SWIG。当我尝试运行 ndk-build.cmd 时,出现错误

jni/soundtouch/wrapper_wrap.cpp:在函数'void Java_com_talkingyeti_jni2_wrapperJNI_SoundTouch_1putSamples(JNIEnv*,_jclass*,jlong​​,_jobject*,jlong​​,jlong​​)'中:jni/soundtouch/wrapper_wrap.cpp:545:错误:'SAMPLETYPE'未在此范围 jni/soundtouch/wrapper_wrap.cpp:545: 错误: 'arg2' 未在此范围内声明 jni/soundtouch/wrapper_wrap.cpp:553: 错误: ')' 标记 jni/soundtouch/wrapper_wrap 之前的预期主表达式。 cpp:560: 错误: 'const'之前的预期')' jni/soundtouch/wrapper_wrap.cpp:560: 错误: ';'之前的预期')' 令牌制作:* [obj/local/armeabi/objs/soundtouch/wrapper_wrap.o] 错误 1

此问题发生在以下 wrapper_wrap.cpp 块中:

  SWIGEXPORT void JNICALL Java_com_talkingyeti_jni2_wrapperJNI_SoundTouch_1putSamples(JNIEnv *jenv, jclass jcls, jlong jarg1, jobject jarg1_, jlong jarg2, jlong jarg3) {
  soundtouch::SoundTouch *arg1 = (soundtouch::SoundTouch *) 0 ;
  SAMPLETYPE *arg2 = (SAMPLETYPE *) 0 ;
  uint arg3 ;
  uint *argp3 ;

  (void)jenv;
  (void)jcls;
  (void)jarg1_;
  arg1 = *(soundtouch::SoundTouch **)&jarg1; 
  arg2 = *(SAMPLETYPE **)&jarg2; 
  argp3 = *(uint **)&jarg3; 
  if (!argp3) {
    SWIG_JavaThrowException(jenv, SWIG_JavaNullPointerException, "Attempt to dereference null uint");
    return ;
  }

请建议我需要对 SAMPLETYPE 进行哪些更改才能正确编译 NDK 并生成 SO 文件。

4

1 回答 1

2

看来你错过了一个标题。确保你有:

#include "soundtouch/include/SoundTouch.h"

using namespace soundtouch;
于 2013-10-24T11:34:37.227 回答