一、从官网下载最新版本的Zlib库:
版本:https://www.zlib.net/zlib-1.2.11.tar.gz
解压至 D:\Zlib-1.2.11\ 后开始准备编译
二、开始编译:
1. VS环境下,Windows平台的.lib文件可以直接在
D:\Zlib-1.2.11\contrib\vstudio\
目录找到对应的sln工程文件,打开编译即可!
2. QT+MinGw环境下,Windows平台的.a文件需要在命令行操作:
先打开Qt+MinGw命令行环境:
依次输入下面两行即可:
copy "win32\makefile.gcc" "Makefile.gcc"
mingw32-make -f Makefile.gcc
如下图:
此时会生成lib.a libz.dll.a zlib1.dll三个文件
在其他QT工程用到zlib时,在pro文件中加上几句即可:
INCLUDEPATH += D:/zlib-1.2.11/
LIBS += -L D:/zlib-1.2.11/libz.a
LIBS += -L D:/zlib-1.2.11/libz.dll.a
LIBS += -L D:/zlib-1.2.11/zlib1.dll
注意,这个是使用Qt Quazip库的前提!!!
下一篇幅再讲详细Quazip编译方法