在Windows上使用MSVC编译QuaZip

本文详细介绍了如何使用CMake配置QuaZIP并生成VS解决方案文件,在遇到编译错误时的排查过程及解决方法,包括解决缺少zlib.h、dll导入静态问题和宏定义误写导致的errorC2491等问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

QuaZip现在已经可以用MSVC在Windows上编译成功了。

构建可使用CMake或qmake都可以。

但目前(0-4-3)的原有脚本有些问题,会出现errror C2491,怀疑是有个宏定义误写错导致。

编译过程及问题解决:


1. Used CMake (或qmake)  to configure QuaZIP and generate VS solution file;
2. Tried to compile Debug and got missing ‘zlib.h’ problem;
3. Added path to Qt copy of zlib (in my case “C:/Qt/4.7.4/src/3rdparty/zlib”) to C/C++->General->Additional Include Directories;
4. That fixed missing ‘zlib.h’ but then I got “error C2491: dllimport static” issue on QuaZipFile::staticMetaObject;
5. Checked preprocessor definitions for quazip project (C/C++->Preprocessor->Preprocessor Definitions” and found thatQUAZIP_BUILD is not defined (it should be) — instead there is a useless define “quazip_EXPORTS” which was probably supposed to be QUAZIP_BUILD but CMake configuration for VisualStudio is buggy;
6. Got rid of quazip_EXPORTS and added QUAZIP_BUILD — now at least Debug configuration builds! 把这个宏定义修改过来就可以了

转载于:https://www.cnblogs.com/justin_s/archive/2011/11/13/2247210.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值