最近写个Qt demo,想要使用压缩和解压多个文件的功能,并不使用额外进程。网上参考了不少资料,发现只有QuaZip比较适合个人需求。可是QuaZip只提供源码,所以须要本身来编译。windows
QuaZIP is a simple C++ wrapper over Gilles Vollant's ZIP/UNZIP package that can be used to access ZIP archives. It uses the Qt toolkit.app
简单来讲,QuaZip就是zlib(解压缩软件)的Qt封装类,在Qt开发环境中很是好用。this
解压缩目录下
的quazip
子目录中的quazip.pro
工程文件(VS会提示从新生成配置文件,选择“是”)。重点来了,用VS打开zconf.h
文件,并将:.net
#if 1 /* HAVE_UNISTD_H -- this line is updated by ./configure */ # include <sys/types.h> /* for off_t */ # include <unistd.h> /* for SEEK_* and off_t */ # ifdef VMS # include <unixio.h> /* for off_t */ # endif # define z_off_t off_t #endif
这几行替换为如下代码:插件
#ifdef HAVE_UNISTD_H #include <sys types.h=""> / for off_t / #include <unistd.h> / for SEEK_ and off_t */ #define z_off_t off_t #endif这是由于windows下没有unistd.h这个文件,这是类unix系统才有的。
顺利编译经过,生成动态连接库。unix