简体   繁体   中英

Compile quazip under windows 8.1 and qt creator

I'm new and trying to use Quazip under qt 5.5. So I just downloaded project sources from http://quazip.sourceforge.net/ and opened .pro file. When I try to build project I 've got multiple errors:

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

To avoid building zlib on windows I just installed (from here: http://gnuwin32.sourceforge.net/packages/zlib.htm ) complete pack for windows in C:\\GnuWin32. Then I added this line in .pro file:

INCLUDEPATH += C:\GnuWin32\include

This generated another error:

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

But changing this line

#if 1           /* HAVE_UNISTD_H -- this line is updated by ./configure */

into this fixed the problem.

#if HAVE_UNISTD_H

Unfortunately now I get 25 unresolved external symbols, some of them:

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)

I tries adding this line:

LIBS += -LC:\GnuWin32\lib

But that didn't solve the problem. WHat is the easiest way to use Quazip under Qt?

  1. Download quazip source from quzip site
  2. Open by Qt Creator quazip.pri
  3. Replace all strings #include "zlib.h" or "#include < zlib.h>"

to

#include <QtZlib/zlib.h>
  1. Build project and run unit tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM