首页 > 解决方案 > quazip-0-7-3 在 Windows 上构建失败

问题描述

以下是我所做的和错误消息:

从http://quazip.sourceforge.net/index.html下载 quazip-0-7-3并解压到 c:\Qt,运行以下命令,最后得到错误:

C:\Qt\quazip-0.7.3\quazip>where qmake
C:\Qt\5.10.0\msvc2015\bin\qmake.exe

C:\Qt\quazip-0.7.3\quazip>where qmake
C:\Qt\5.10.0\msvc2015\bin\qmake.exe

C:\Qt\quazip-0.7.3\quazip>qmake PREFIX=c:\Qt\quazip
Info: creating stash file C:\Qt\quazip-0.7.3\quazip\.qmake.stash

C:\Qt\quazip-0.7.3\quazip>where make
C:\Program Files (x86)\GnuWin32\bin\make.exe

C:\Qt\quazip-0.7.3\quazip>make
make -f Makefile.Release
make[1]: Entering directory `C:/Qt/quazip-0.7.3/quazip'
Makefile.Release:120: *** missing separator.  Stop.
make[1]: Leaving directory `C:/Qt/quazip-0.7.3/quazip'
make: *** [release] Error 2

下面是 Makefile.Release 从第 115 行到第 155 行,第 120 行是“<<”:

 .SUFFIXES: .c .cpp .cc .cxx

{release}.cpp{release\}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

{release}.cc{release\}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

{release}.cxx{release\}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

{release}.c{release\}.obj::
    $(CC) -c $(CFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

{.}.cpp{release\}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

{.}.cc{release\}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

{.}.cxx{release\}.obj::
    $(CXX) -c $(CXXFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

{.}.c{release\}.obj::
    $(CC) -c $(CFLAGS) $(INCPATH) -Forelease\ @<<
    $<
<<

然后我使用'nmake'而不是'make',但它再次失败并出现不同的错误:

C:\Qt\quazip-0.7.3\quazip>nmake

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin\nmake.exe" -f Makefile.Release

Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
Copyright (C) Microsoft Corporation.  All rights reserved.

        cl -BxC:\Qt\5.10.0\msvc2015\bin\qmake.exe -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -E ..\..\5.10.0\msvc2015\mkspecs\features\data\dummy.cpp 2>NUL >release\moc_predefs.h
        C:\Qt\5.10.0\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL --compiler-flavor=msvc --include release/moc_predefs.h -IC:/Qt/5.10.0/msvc2015/mkspecs/win32-msvc -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/5.10.0/msvc2015/include -IC:/Qt/5.10.0/msvc2015/include/QtCore quagzipfile.h -o release\moc_quagzipfile.cpp
        C:\Qt\5.10.0\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL --compiler-flavor=msvc --include release/moc_predefs.h -IC:/Qt/5.10.0/msvc2015/mkspecs/win32-msvc -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/5.10.0/msvc2015/include -IC:/Qt/5.10.0/msvc2015/include/QtCore quaziodevice.h -o release\moc_quaziodevice.cpp
        C:\Qt\5.10.0\msvc2015\bin\moc.exe -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL --compiler-flavor=msvc --include release/moc_predefs.h -IC:/Qt/5.10.0/msvc2015/mkspecs/win32-msvc -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/quazip-0.7.3/quazip -IC:/Qt/5.10.0/msvc2015/include -IC:/Qt/5.10.0/msvc2015/include/QtCore quazipfile.h -o release\moc_quazipfile.cpp
        cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\yhuang\AppData\Local\Temp\nm402C.tmpqioapi.cpp
.\qioapi.cpp(11): fatal error C1083: Cannot open include file: 'stdio.h': No such file or directory
JlCompress.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quaadler32.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quacrc32.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quagzipfile.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quaziodevice.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazip.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipdir.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipfile.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipfileinfo.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
quazipnewinfo.cpp
..\..\5.10.0\msvc2015\include\QtCore/qglobal.h(45): fatal error C1083: Cannot open include file: 'type_traits': No such file or directory
Generating Code...
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\bin\cl.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\bin\nmake.exe"' : return code '0x2'
Stop.

在@hole-otter-rosy的评论之后改成下面的步骤,最后还是报错 - C:\Qt\quazip-0.7.3\quazip>where qmake C:\Qt\5.10.0\msvc2015\bin\ qmake.exe

C:\Qt\quazip-0.7.3\quazip>"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools\vsvars32.bat"

C:\Qt\quazip-0.7.3\quazip>qmake PREFIX=c:\Qt\quazip INCPATH+=C:\Qt\zlib-1.2.11

注意:“zlib-1.2.11”包含 quazip 项目所需的 zlib.h。运行'nmake',我得到以下链接错误:

    C:\Qt\quazip-0.7.3\quazip>nmake

    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.

    "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN\nmake.exe" -f Makefile.Release

    Microsoft (R) Program Maintenance Utility Version 14.00.24210.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
        cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I..\..\zlib-1.2.11 -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\yhuang\AppData\Local\Temp\nm2D8C.tmp
qioapi.cpp
JlCompress.cpp
quaadler32.cpp
quacrc32.cpp
quagzipfile.cpp
quaziodevice.cpp
quazip.cpp
quazipdir.cpp
quazipfile.cpp
Generating Code...
    cl -c -nologo -Zc:wchar_t -FS -Zc:strictStrings -O2 -MD -W3 -w44456 -w44457 -w44458 -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I..\..\zlib-1.2.11 -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\yhuang\AppData\Local\Temp\nm44F3.tmp
unzip.c
zip.c
Generating Code...
    cl -c -nologo -Zc:wchar_t -FS -Zc:rvalueCast -Zc:inline -Zc:strictStrings -Zc:throwingNew -O2 -MD -W3 -w34100 -w34189 -w44996 -w44456 -w44457 -w44458 -wd4577 -wd4467 -EHsc -DUNICODE -D_UNICODE -DWIN32 -DQUAZIP_BUILD -DNOMINMAX -DQT_NO_DEBUG -DQT_CORE_LIB -DNDEBUG -D_WINDLL -I. -I..\..\zlib-1.2.11 -I. -I..\..\5.10.0\msvc2015\include -I..\..\5.10.0\msvc2015\include\QtCore -Irelease -I..\..\5.10.0\msvc2015\mkspecs\win32-msvc -Forelease\ @C:\Users\yhuang\AppData\Local\Temp\nm46E8.tmp
moc_quagzipfile.cpp
moc_quaziodevice.cpp
moc_quazipfile.cpp
Generating Code...
    link /NOLOGO /DYNAMICBASE /NXCOMPAT /INCREMENTAL:NO /DLL /SUBSYSTEM:WINDOWS /MANIFEST:embed /OUT:release\quazip.dll @C:\Users\yhuang\AppData\Local\Temp\nm4ED5.tmp
   Creating library release\quazip.lib and object release\quazip.exp
quaadler32.obj : error LNK2019: unresolved external symbol _adler32 referenced in function "public: __thiscall QuaAdler32::QuaAdler32(void)" (??0QuaAdler32@@QAE@XZ)
quacrc32.obj : error LNK2019: unresolved external symbol _crc32 referenced in function "public: __thiscall QuaCrc32::QuaCrc32(void)" (??0QuaCrc32@@QAE@XZ)
unzip.obj : error LNK2001: unresolved external symbol _crc32zip.obj : error LNK2001: unresolved external symbol _crc32
quagzipfile.obj : error LNK2019: unresolved external symbol _gzdopen referencedin function "private: bool __thiscall QuaGzipFilePrivate::open<int>(int,class QFlags<enum QIODevice::OpenModeFlag>,class QString &)" (??$open@H@QuaGzipFilePrivate@@AAE_NHV?$QFlags@W4OpenModeFlag@QIODevice@@@@AAVQString@@@Z)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzread referenced in function "protected: virtual __int64 __thiscall QuaGzipFile::readData(char *,__int64)" (?readData@QuaGzipFile@@MAE_JPAD_J@Z)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzwrite referencedin function "protected: virtual __int64 __thiscall QuaGzipFile::writeData(char const *,__int64)" (?writeData@QuaGzipFile@@MAE_JPBD_J@Z)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzflush referencedin function "public: virtual bool __thiscall QuaGzipFile::flush(void)" (?flush@QuaGzipFile@@UAE_NXZ)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzclose referencedin function "public: virtual __thiscall QuaGzipFile::~QuaGzipFile(void)" (??1QuaGzipFile@@UAE@XZ)
quagzipfile.obj : error LNK2019: unresolved external symbol _gzopen referenced in function "private: bool __thiscall QuaGzipFilePrivate::open<class QString>(class QString,class QFlags<enum QIODevice::OpenModeFlag>,class QString &)" (??$open@VQString@@@QuaGzipFilePrivate@@AAE_NVQString@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@AAV1@@Z)
quaziodevice.obj : error LNK2019: unresolved external symbol _deflate referenced in function "public: virtual bool __thiscall QuaZIODevice::flush(void)" (?flush@QuaZIODevice@@UAE_NXZ)
zip.obj : error LNK2001: unresolved external symbol _deflatequaziodevice.obj : error LNK2019: unresolved external symbol _deflateEnd referenced in function "public: virtual void __thiscall QuaZIODevice::close(void)" (?close@QuaZIODevice@@UAEXXZ)
zip.obj : error LNK2001: unresolved external symbol _deflateEnd
quaziodevice.obj : error LNK2019: unresolved external symbol _inflate referenced in function "protected: virtual __int64 __thiscall QuaZIODevice::readData(char*,__int64)" (?readData@QuaZIODevice@@MAE_JPAD_J@Z)
unzip.obj : error LNK2001: unresolved external symbol _inflatequaziodevice.obj : error LNK2019: unresolved external symbol _inflateEnd referenced in function "public: virtual void __thiscall QuaZIODevice::close(void)" (?close@QuaZIODevice@@UAEXXZ)
unzip.obj : error LNK2001: unresolved external symbol _inflateEnd
quaziodevice.obj : error LNK2019: unresolved external symbol _deflateInit_ referenced in function "public: virtual bool __thiscall QuaZIODevice::open(class QFlags<enum QIODevice::OpenModeFlag>)" (?open@QuaZIODevice@@UAE_NV?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
quaziodevice.obj : error LNK2019: unresolved external symbol _inflateInit_ referenced in function "public: virtual bool __thiscall QuaZIODevice::open(class QFlags<enum QIODevice::OpenModeFlag>)" (?open@QuaZIODevice@@UAE_NV?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z)
unzip.obj : error LNK2019: unresolved external symbol _inflateInit2_ referencedin function _unzOpenCurrentFile3
unzip.obj : error LNK2019: unresolved external symbol _get_crc_table referencedin function _unzOpenCurrentFile3
zip.obj : error LNK2001: unresolved external symbol _get_crc_table
zip.obj : error LNK2019: unresolved external symbol _deflateInit2_ referenced in function _zipOpenNewFileInZip4_64release\quazip.dll : fatal error LNK1120: 17 unresolved externals
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\BIN\link.EXE"' : return code '0x460'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 14.0
\VC\BIN\nmake.exe"' : return code '0x2'
Stop.

标签: qtmakefilebuildqmakequazip

解决方案


您正在使用 Qt 的 MSVC 版本,因此无法使用 MinGW 的品牌。

使用 nmake 时出现的错误表明您尚未设置 MSVC 构建环境。有关详细信息,请参阅MSVC 文档中的命令行上构建 C/C++ 代码。


推荐阅读