首页 > 如何将Speex编译为供JNI调用的dll文件?

如何将Speex编译为供JNI调用的dll文件?

用NDK编译为.so文件没问题
但用MinGW64编译为.dll却各种报错
比如:

..\jni\libspeex\arch.h:65:2: error: #error You now need to define either FIXED_POINT or FLOATING_POINT

知道了,以CDT+MinGW64为例
在Properties -> C/C++ Build -> Settings -> GCC C Compiler -> Symbols里
Defined Symbols里添加FIXED_POINT、EXPORT=""、USE_KISS_FFT三项
在UnDefined Symbols里添加HAVE_CONFIG_H;

如果你用的是Speex官网下载的文件,需要将include/speex/speex_config_types.h.in的.in去掉,并将内容改为:

#ifndef __SPEEX_TYPES_H__
#define __SPEEX_TYPES_H__

/* these are filled in by configure */
typedef short spx_int16_t;
typedef unsigned short spx_uint16_t;
typedef int spx_int32_t;
typedef unsigned int spx_uint32_t;

#endif

然后可能还会遇到找不到头文件的问题,这个我尝试在项目的Includes里加入include文件夹但没有效果,最后是手动改代码里的路径解决的。

【热门文章】
【热门文章】