2013-03-26 77 views
4

我試圖在安裝了Qt 5.0.1 32位LGPL的Windows 7(32位)上構建quazip庫(0.5.1版)。如何在Windows 7上構建Quazip 0.5.1?

當我在Qt的Commandprompt運行:

qmake 
mingw32-make 

設置爲在其中予提取Quazip的文件夾的目錄(C:\ Qt的\ quazip-0.5.1 \ quazip)時,得到以下錯誤日誌:

C:\Qt\quazip-0.5.1\quazip>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,release\libquazip.a -o release\qua 
zip.dll object_script.quazip.Release -LC:\Qt\Qt5\5.0.1\mingw47_32\lib -lQt5Core 
./release\unzip.o:unzip.c:(.text+0x1008): undefined reference to `crc32' 
./release\unzip.o:unzip.c:(.text+0x10aa): undefined reference to `inflate' 
./release\unzip.o:unzip.c:(.text+0x10da): undefined reference to `crc32' 
./release\unzip.o:unzip.c:(.text+0x1110): undefined reference to `crc32' 
./release\unzip.o:unzip.c:(.text+0x1327): undefined reference to `inflateEnd' 
./release\unzip.o:unzip.c:(.text+0x1727): undefined reference to `get_crc_table' 
./release\unzip.o:unzip.c:(.text+0x186f): undefined reference to `inflateInit2_' 
./release\zip.o:zip.c:(.text+0xac7): undefined reference to `crc32' 
./release\zip.o:zip.c:(.text+0xb7c): undefined reference to `deflate' 
./release\zip.o:zip.c:(.text+0xcdf): undefined reference to `deflate' 
./release\zip.o:zip.c:(.text+0xef5): undefined reference to `deflateEnd' 
./release\zip.o:zip.c:(.text+0x13a8): undefined reference to `get_crc_table' 
./release\zip.o:zip.c:(.text+0x1af9): undefined reference to `deflateInit2_' 
./release\quaadler32.o:quaadler32.cpp:(.text+0x2e): undefined reference to `adle 
r32' 
./release\quaadler32.o:quaadler32.cpp:(.text+0x61): undefined reference to `adle 
r32' 
./release\quaadler32.o:quaadler32.cpp:(.text+0xa1): undefined reference to `adle 
r32' 
./release\quaadler32.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: ./release\quaadler32.o: bad reloc address 0x0 in section `. 
rdata$_ZTI13QuaChecksum32[__ZTI13QuaChecksum32]' 
collect2.exe: error: ld returned 1 exit status 
Makefile.Release:106: recipe for target 'release\quazip.dll' failed 
mingw32-make[1]: *** [release\quazip.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:\ Qt的\ QT5 \ 5.0.1 \ SRC \ qtbase的\ src \的3rdParty \ zlib的)都安裝了所有這些列出的文件。

當我試圖解決這個問題,我已經加入到quazip.pro進入quazip.pri:

INCLUDEPATH += $$[QT_INSTALL_PREFIX]/src/3rdparty/zlib 

,它是如何建議here

我在Google上發現的所有其他解決方案都無濟於事。

我希望有人能幫助我。

問候, LVreg

+0

我必須明確地使用,當你運行的qmake您應該包括頭一個也是庫的路徑當從命令行調用'qmake'時調用'INCLUDEPATH'和'LIBS',例如:'qmake PREFIX = ../install LIBS + = INCLUDEPATH + = 。把它放在'pro'文件中也不適用於我。 – 2013-04-22 09:12:21

回答

1

這裏是爲我工作(QuaZip 0.7在Windows 7 MSVC13 32位編譯):

在命令行中鍵入:

SET INCLUDE=<PathToZib\include>;%INCLUDE% 
SET LIB=<PathToZib\lib>;%LIB% 
qmake PREFIX=<FolderWhereInstallWillPutFiles> LIBS+=<PathToZib\lib>/zdll.lib 
nmake 
nmake install 

之間的一切<>必須更改爲您的適用路徑

注意: 在LIBS + =部分使用/而不是\作爲文件夾分隔符

3

問題是QuaZIP找不到zlib庫。如果你想看看

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/

+0

這適用於我,不是當我在'quazip-0.7.1'中運行它時,而是當我在'quazip-0.7.1/quazip'中運行它時。不確定,但我猜這些參數在.pro文件調用其他.pro文件時不會傳播。 – 2015-07-05 05:35:44