我正在尝试使用 Android NDK编译SoundTouch库。我从这里得到了一些指令来在 android 中编译这个库。
但是当我尝试使用ndk-build
命令编译它时,它会在 SoundTouch lib 的各种源文件中显示错误,如下所示:
我尝试按照说明中的说明关闭异常处理,但它似乎不起作用。
我将 SoundTouch 源中的所有文件复制到项目的 JNI 文件夹中。这是我的android.mk
文件:
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CFLAGS :- -frtti -fexceptions
LOCAL_SRC_FILES := AAFilter.cpp BPMDetect.cpp cpu_detect_x86.cpp FIFOSampleBuffer.cpp FIRFilter.cpp main.cpp mmx_optimized.cpp PeakFinder.cpp RateTransposer.cpp RunParameters.cpp SoundTouch.cpp sse_optimized.cpp TDStretch.cpp WavFile.cpp
LOCAL_LDLIBS := -lpcap
LOCAL_MODULE := libSoundTouch
LOCAL_C_INCLUDES := BPMDetect.h FIFOSampleBuffer.h FIFOSamplePipe.h SoundTouch.h STTypes.h
include $(BUILD_SHARED_LIBRARY)
谁能帮我在android上编译和使用SoundTouch lib?
更新 :
我改变了我的android.mk
文件如下
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_CPP_FEATURES += -fno-exceptions
LOCAL_SRC_FILES := \
SoundTouch/AAFilter.cpp \
SoundTouch/BPMDetect.cpp \
SoundTouch/cpu_detect_x86.cpp\
SoundTouch/FIFOSampleBuffer.cpp \
SoundTouch/FIRFilter.cpp \
SoundTouch/mmx_optimized.cpp \
SoundTouch/PeakFinder.cpp \
SoundTouch/RateTransposer.cpp \
SoundTouch/SoundTouch.cpp \
SoundTouch/sse_optimized.cpp \
SoundTouch/TDStretch.cpp
LOCAL_MODULE := libSoundTouch
LOCAL_C_INCLUDES := include/BPMDetect.h include/FIFOSampleBuffer.h include/FIFOSamplePipe.h include/SoundTouch.h include/STTypes.h
include $(BUILD_SHARED_LIBRARY)
现在一切正常。谢谢