c++qtquazip

How to use Quazip with Qt 5.6, Qt Creator on Windows 10?


Sorry that I am not experienced in this kind of stuff, but I have been searching the internet for a while to find out how to use Quazip with Qt 5.6 on Win 10. I would greatly appreciate a list of steps on how to build Quazip and use it in Qt Creator.

So far, I tried downloading Quazip, and including the pri file in my .pro file

include(quazip-0.7.2/quazip.pri)

Then I replaced every instance of:

#include "zlib.h"

and

#include <zlib.h>

to

#include <QtZlib/zlib.h>

After I do this, I have many compiler warnings along with a few errors.

My errors are :

QuaZIODevice::staticMetaObject': definition of dllimport static data member not allowed
QuaGzipFile::staticMetaObject': definition of dllimport static data member not allowed
QuaZipFile::staticMetaObject': definition of dllimport static data member not allowed

And all 15 of my warnings contain:

inconsistent dll linkage

I greatly appreciate any help on this matter.


Solution

  • A quote from the documentation:

    By default, QuaZIP compiles as a DLL/SO, but you have other options:

    • Just copy appropriate source files to your project and use them, but you need to define QUAZIP_STATIC before including any QuaZIP headers (best done as a compiler option). This will save you from possible side effects of importing/exporting QuaZIP symbols.

    This seems to be what you're doing, so you should probably add DEFINES += QUAZIP_STATIC to your .pro file.