2

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?

Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
Isaac
  • 115
  • 10

1 Answers1

6
  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.
synacker
  • 1,722
  • 13
  • 32
  • It works, thank you! But how am I supposed to know that qt has it owns implementation of zlib? – Isaac Sep 17 '15 at 07:40
  • @Isaac Qt don't have own implementation of zlib. In $$[QTDIR]\Src\qtbase\src\3rdparty\zlib located zlib version, that Qt use. #include work just such as alias to zlib.h. – synacker Sep 17 '15 at 07:52
  • Fantastic, fixed that for me. Other unresolved symbols, but this was great. Thanks @Milovidov. – bmahf Aug 30 '16 at 18:05
  • I think it was a compiler mismatch between my windows path an qtcreator. Working now by compiling everything from command line. – Damien Apr 25 '17 at 10:18