我正在尝试在安装了Qt 5.0.1 32位LGPL的Windows 7(32位)上构建quazip库(版本0.5.1)。
当我在qt命令提示符中运行时:
qmake
mingw32-make
将目录设置为提取Quazip的文件夹(C:Qt Quazip -0.5.1 Quazip),我得到以下错误日志:
C:Qtquazip-0.5.1quazip>mingw32-make
mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory 'C:/Qt/quazip-0.5.1/quazip'
g++ -Wl,-s -shared -mthreads -Wl,--out-implib,releaselibquazip.a -o releasequa
zip.dll object_script.quazip.Release -LC:QtQt55.0.1mingw47_32lib -lQt5Core
./releaseunzip.o:unzip.c:(.text+0x1008): undefined reference to `crc32'
./releaseunzip.o:unzip.c:(.text+0x10aa): undefined reference to `inflate'
./releaseunzip.o:unzip.c:(.text+0x10da): undefined reference to `crc32'
./releaseunzip.o:unzip.c:(.text+0x1110): undefined reference to `crc32'
./releaseunzip.o:unzip.c:(.text+0x1327): undefined reference to `inflateEnd'
./releaseunzip.o:unzip.c:(.text+0x1727): undefined reference to `get_crc_table'
./releaseunzip.o:unzip.c:(.text+0x186f): undefined reference to `inflateInit2_'
./releasezip.o:zip.c:(.text+0xac7): undefined reference to `crc32'
./releasezip.o:zip.c:(.text+0xb7c): undefined reference to `deflate'
./releasezip.o:zip.c:(.text+0xcdf): undefined reference to `deflate'
./releasezip.o:zip.c:(.text+0xef5): undefined reference to `deflateEnd'
./releasezip.o:zip.c:(.text+0x13a8): undefined reference to `get_crc_table'
./releasezip.o:zip.c:(.text+0x1af9): undefined reference to `deflateInit2_'
./releasequaadler32.o:quaadler32.cpp:(.text+0x2e): undefined reference to `adle
r32'
./releasequaadler32.o:quaadler32.cpp:(.text+0x61): undefined reference to `adle
r32'
./releasequaadler32.o:quaadler32.cpp:(.text+0xa1): undefined reference to `adle
r32'
./releasequaadler32.o:quaadler32.cpp:(.text+0xb1): undefined reference to `adle
r32'
c:/qt/qt5/tools/mingw/bin/../lib/gcc/i686-w64-mingw32/4.7.2/../../../../i686-w64
-mingw32/bin/ld.exe: ./releasequaadler32.o: bad reloc address 0x0 in section `.
rdata$_ZTI13QuaChecksum32[__ZTI13QuaChecksum32]'
collect2.exe: error: ld returned 1 exit status
Makefile.Release:106: recipe for target 'releasequazip.dll' failed
mingw32-make[1]: *** [releasequazip.dll] Error 1
mingw32-make[1]: Leaving directory 'C:/Qt/quazip-0.5.1/quazip'
makefile:34: recipe for target 'release' failed
mingw32-make: *** [release] Error 2
但是在我的zlib文件夹(C:QtQt55.0.1Srcqtbase Src 3rdpartyzlib)中安装了所有这些列出的文件。
.
当我试图解决这个问题时,我已经加入了quazip。导入quazip.pri:
INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib
,这里是如何建议的。
到目前为止,我在谷歌上找到的所有其他解决方案都没有帮助。
我希望你们中有人能帮助我。
问候,LVreg
问题是QuaZIP找不到zlib库。当你运行qmake:
时,你应该包括头文件和库的路径。qmake "INCLUDEPATH+=C:/Qt/Qt5/5.0.1/Src/qtbase/src/3rdparty/zlib" "LIBS+=-LC:/Qt/Qt5/5.0.1/Src/qtbase/src/3rdparty/zlib -lz"
mingw32-make
如果你想看的话,我的博客里有完整的解释:http://www.antonioborondo.com/2014/10/22/zipping-and-unzipping-files-with-qt/
这是为我工作的(QuaZip 0.7在Windows 7上用MSVC13 32位编译):
在命令行中输入:
SET INCLUDE=<PathToZibinclude>;%INCLUDE%
SET LIB=<PathToZiblib>;%LIB%
qmake PREFIX=<FolderWhereInstallWillPutFiles> LIBS+=<PathToZiblib>/zdll.lib
nmake
nmake install
<>之间的所有内容必须更改为您的适用路径
注意:在LIBS+=部分使用/代替作为文件夹分隔符
尝试在Windows上创建quazip库-看这里:
https://www.maefloresta.com/wiki/doku.php?id=quazip_windowsbut -试试下面的命令-而不是"make"采取"mingw32-make".