问题
I am trying to compile Soundtouch library with Android NDK. I successfully installed Cygwin and SWIG required for Soundtouch library. When I try to run ndk-build.cmd, i am getting an error
jni/soundtouch/wrapper_wrap.cpp: In function 'void Java_com_talkingyeti_jni2_wrapperJNI_SoundTouch_1putSamples(JNIEnv*, _jclass*, jlong, _jobject*, jlong, jlong)': jni/soundtouch/wrapper_wrap.cpp:545: error: 'SAMPLETYPE' was not declared in this scope jni/soundtouch/wrapper_wrap.cpp:545: error: 'arg2' was not declared in this scope jni/soundtouch/wrapper_wrap.cpp:553: error: expected primary-expression before ')' token jni/soundtouch/wrapper_wrap.cpp:560: error: expected ')' before 'const' jni/soundtouch/wrapper_wrap.cpp:560: error: expected ')' before ';' token make: * [obj/local/armeabi/objs/soundtouch/wrapper_wrap.o] Error 1
This issue happens with the following block of 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 ;
}
Please suggest me what all changes I need to make on the SAMPLETYPE to compile NDK properly and to generate SO file.
回答1:
It's seem you missed a header. Make sure you have:
#include "soundtouch/include/SoundTouch.h"
and
using namespace soundtouch;
来源:https://stackoverflow.com/questions/18783644/soundtouch-library-compile-issue