在Windows上使用MSVC编译QuaZip
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! 把这个宏定义修改过来就可以了