Solved Problems with QuaZip
-
Files (zdll.lib, zlib.def and zlib1.dll) are from pre compiled dll package from Zlib's website.
Atm quazip folder looks like this http://imgur.com/nkFeqSc
And .pro file has this for windowswin32 { LIBS += -L$$PWD/quazip -lzdll }
W7 64bit, QT 5.6
-
@Kamba
What compiler was used to compile that library and what compiler are you using?QString, QString)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] bool JlCompress::compressFile(QuaZip* zip, QString fileName, QString fileDest) { ^
This looks like a problem @koahnig was recently tackling, see here. The cause finally was discovered to be sources sneaking into the application code from the library.
error: undefined reference to `_imp___ZN10JlCompress10extractDirE7QStringS0_'
That's the linker complaining that your symbol can't be found.
AFAIK this should be a C library. So i dont see why you should get dllimport related errors?
C libraries export symbols exactly the same way as C++ libraries do. The only difference is that C++ symbol names are decorated.
Kind regards.
-
@kshegunov said:
@Kamba
What compiler was used to compile that library and what compiler are you using?QString, QString)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] bool JlCompress::compressFile(QuaZip* zip, QString fileName, QString fileDest) { ^
This problem occurs on windows with MinGW 32bit.
-
@Kamba
This was a question consisting of two parts, and you answered only half of it. Is the library you're trying to link against compiled with 32bit MinGW?
Forget that, it's irrelevant as zlib is a C library.HEADERS += $PWD/quazip/*.h SOURCES += $PWD/quazip/*.cpp SOURCES += $PWD/quazip/*.c
So instead of building quazip as a library as it was intended, you're just inserting source. It's not going to work like that. Build quazip separately, and then link it to your project.
-
@kshegunov
Zlib? I don't know what compiler Zlib devs were using when they compiled it. I downloaded compiled dlls.
http://zlib.net/zlib128-dll.zip
I could try to compile it by myself from this
http://zlib.net/zlib128.zip -
Zlib? I don't know what compiler Zlib devs were using when they compiled it. I downloaded compiled dlls.
Yes, and it doesn't matter. It's my bad, sorry and we cross posted.
You should follow the instructions for building the library given on quazip's site, though. -
@kshegunov said:
Zlib? I don't know what compiler Zlib devs were using when they compiled it. I downloaded compiled dlls.
Yes, and it doesn't matter. It's my bad, sorry and we cross posted.
You should follow the instructions for building the library given on quazip's site, though.But how it is working on linux then if the problem is in quazip?
I'm going to try building quazip on windows. Should I also do same for linux? Then I don't need to include sources in the project right? -
But how it is working on linux then if the problem is in quazip?
On Linux
Q_DECL_EXPORT
expands to nothing, because there, the symbols are exported by default. On Windows it expands to__declspec(...)
depending on whether it's import or export. The compiler and/or linker doesn't like this declaration specifier to be repeated and will not handle conflicts involving it very gracefully.Basically, when you include the headers from the library you're telling the linker to import the symbol. But that symbol is nowhere to be found (as you don't have the quazip library at all) and the linker is confused ... it doesn't know where to get it, so you get the undefined references error.
I'm going to try building quazip on windows. Should I also do same for linux? Then I don't need to include sources in the project right?
Yes, you do the same for linux.
Yes, you don't include sources in the project.Kind regards.
-
Now I got it working. Built QuaZip on windows and linux.
added to .pro fileINCLUDEPATH += $$PWD/quazip LIBS += -L$$PWD/libs/ -lz LIBS += -L$$PWD/libs/ -lquazip
In quazip folder I have headers of Quazip. In libs folder I have .a files for windows and .so files for linux.
Including quazip for extracting works.#include "quazip/JlCompress.h"
This setup is working on both platforms. So I guess this is it?
-