andorid NDK 使用 zlib.h 报错:undefined reference to inflateInit2_

android NDK 开发中使用了gzip 压缩的功能,并引入了 #include 头文件,

但是 编译的时候一直报错:

undefined reference to `inflateInit2_'
undefined reference to `inflateEnd'
undefined reference to `inflate'
undefined reference to `inflateEnd'
undefined reference to `inflateEnd'

解决:

CmakeList.txt 中添加 一行:

link_libraries(z)

要在  add_library () 引入cpp 文件的上面添加。

你可能感兴趣的:(android开发之NDK)