我是新手,正在尝试在qt 5.5下使用Quazip。因此,我只是从http://quazip.sourceforge.net/下载项目源并打开了.pro文件。当我尝试构建项目时,我遇到了多个错误:

C1083: Cannot open include file: 'zlib.h': No such file or directory

为了避免在Windows上构建zlib,我刚刚在C:\ GnuWin32中为Windows安装了完整的软件包(从此处:http://gnuwin32.sourceforge.net/packages/zlib.htm)。然后我在.pro文件中添加了这一行:
INCLUDEPATH += C:\GnuWin32\include

这产生了另一个错误:
Cannot open include file: 'unistd.h': No such file or directory

但是改变这条线
#if 1           /* HAVE_UNISTD_H -- this line is updated by ./configure */

解决了这个问题。
#if HAVE_UNISTD_H

不幸的是,现在我得到了25个未解析的外部符号,其中一些:
quaadler32.obj:-1: error: LNK2019: unresolved external symbol adler32 referenced in function "public: virtual unsigned int __cdecl QuaAdler32::calculate(class QByteArray const &)" (?calculate@QuaAdler32@@UEAAIAEBVQByteArray@@@Z)
quacrc32.obj:-1: error: LNK2019: unresolved external symbol crc32 referenced in function "public: virtual unsigned int __cdecl QuaCrc32::calculate(class QByteArray const &)" (?calculate@QuaCrc32@@UEAAIAEBVQByteArray@@@Z)
unzip.obj:-1: error: LNK2001: unresolved external symbol crc32
quagzipfile.obj:-1: error: LNK2019: unresolved external symbol gzopen referenced in function "private: void * __cdecl QuaGzipFilePrivate::open(class QString const &,char const *)" (?open@QuaGzipFilePrivate@@AEAAPEAXAEBVQString@@PEBD@Z)
quaziodevice.obj:-1: error: LNK2019: unresolved external symbol deflateInit_ referenced in function "public: virtual bool __cdecl QuaZIODevice::open(class QFlags<enum QIODevice::OpenModeFlag>)" (?open@QuaZIODevice@@UEAA_NV?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
quaziodevice.obj:-1: error: LNK2019: unresolved external symbol inflate referenced in function "protected: virtual __int64 __cdecl QuaZIODevice::readData(char *,__int64)" (?readData@QuaZIODevice@@MEAA_JPEAD_J@Z)

我尝试添加以下行:
LIBS += -LC:\GnuWin32\lib

但这并不能解决问题。在Qt下使用Quazip是最简单的方法吗?

最佳答案

  • quzip site下载quazip源
  • 由Qt Creator quazip.pri打开
  • 替换所有字符串#include“zlib.h”或“#include ”


  • #include <QtZlib/zlib.h>
    
  • 构建项目并运行单元测试。
  • 关于c++ - 在Windows 8.1和Qt Creator下编译quazip,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32611058/

    10-10 06:45