Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Quazip-1.3 static linking issue
QtWS25 Last Chance

Quazip-1.3 static linking issue

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 2 Posters 1.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Cobra91151C Offline
    Cobra91151C Offline
    Cobra91151
    wrote on last edited by Cobra91151
    #1

    Hello!

    I have built Quazip-1.3 libs statically with zlib-win-build-1.2.12 (build-VS2019-MT) - libz-static.lib. When I try to build my project then I get a lot of linking errors:

    LINK : warning LNK4217: symbol '?commit@QSaveFile@@QAE_NXZ (public: bool __thiscall QSaveFile::commit(void))' defined in 'Qt5Cored.lib(qsavefile.obj)' is imported by 'quazip1-qt5d.lib(qioapi.obj)' in function '"bool __cdecl quazip_close(class QIODevice *)" (?quazip_close@@YA_NPAVQIODevice@@@Z)'
    LINK : warning LNK4217: symbol '?staticMetaObject@QSaveFile@@2UQMetaObject@@B (public: static struct QMetaObject const QSaveFile::staticMetaObject)' defined in 'Qt5Cored.lib(qsavefile.obj)' is imported by 'quazip1-qt5d.lib(qioapi.obj)' in function '"class QSaveFile * __cdecl qobject_cast<class QSaveFile *>(class QObject *)" (??$qobject_cast@PAVQSaveFile@@@@YAPAVQSaveFile@@PAVQObject@@@Z)'
    quazip1-qt5d.lib(JlCompress.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QString & __thiscall QString::operator+=(char)" (__imp_??YQString@@QAEAAV0@D@Z) referenced in function "public: static class QStringList __cdecl JlCompress::extractDir(class QuaZip &,class QString const &)" (?extractDir@JlCompress@@SA?AVQStringList@@AAVQuaZip@@ABVQString@@@Z)
      Hint on symbols that are defined and could potentially match:
        "__declspec(dllimport) public: class QString & __thiscall QString::operator+=(class QString const &)" (__imp_??YQString@@QAEAAV0@ABV0@@Z)
    quazip1-qt5d.lib(quazipfileinfo.obj) : error LNK2019: unresolved external symbol "__declspec(dllimport) public: class QIODevice * __thiscall QDataStream::device(void)const " (__imp_?device@QDataStream@@QBEPAVQIODevice@@XZ) referenced in function "class QDateTime __cdecl getNTFSTime(class QByteArray const &,int,int *)" (?getNTFSTime@@YA?AVQDateTime@@ABVQByteArray@@HPAH@Z)
    debug\QuaZipTest.exe : fatal error LNK1120: 2 unresolved externals
    

    Code:

    QuaZipTest.pro:

    QT -= gui
    CONFIG += c++latest console static
    CONFIG -= app_bundle
    
    # You can make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp
    
    # Default rules for deployment.
    #qnx: target.path = /tmp/$${TARGET}/bin
    #else: unix:!android: target.path = /opt/$${TARGET}/bin
    #!isEmpty(target.path): INSTALLS += target
    MOC_DIR = ./resources/moc
    OBJECTS_DIR = ./resources/objects
    RCC_DIR = ./resources/resource
    DEFINES += QUAZIP_STATIC
    INCLUDEPATH += "C:/ZipDev/quazip-1.3/quazip"
    INCLUDEPATH += "C:/ZipDev/zlib-win-build-1.2.12"
    
    CONFIG(debug, debug|release) {
        DESTDIR = $$OUT_PWD/debug
        contains(QMAKE_TARGET.arch, x86_64) {
            LIBS += -L"C:/ZipDev/quazip-1.3/msvc2019/static/x64/debug/quazip/Debug" -lquazip1-qt5d
            LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/x64/Debug" -llibz-static
        } else {
            LIBS += -L"C:/ZipDev/quazip-1.3/msvc2019/static/x86/debug/quazip/Debug" -lquazip1-qt5d
            LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/Debug" -llibz-static
        }
    } else {
        DESTDIR = $$OUT_PWD/release
    
        contains(QMAKE_TARGET.arch, x86_64) {
            LIBS += -L"C:/ZipDev/quazip-1.3/msvc2019/static/x64/release/quazip/Release" -lquazip1-qt5
            LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/x64/Release" -llibz-static
        } else {
            LIBS += -L"C:/ZipDev/quazip-1.3/msvc2019/static/x86/release/quazip/Release" -lquazip1-qt5
            LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/Release" -llibz-static
        }
    }
    
    #QMAKE_POST_LINK = $$(QTDIR)/bin/windeployqt.exe $$shell_quote($$DESTDIR/$$shell_quote($$TARGET).exe) --no-compiler-runtime
    

    main.cpp:

    #include <QCoreApplication>
    #include <QTextStream>
    #include <QTextCodec>
    #include <Windows.h>
    #include "JlCompress.h"
    #include <QDebug>
    
    int main(int argc, char *argv[])
    {
        QCoreApplication app(argc, argv);
        QTextStream output(stdout);
        output.setCodec(QTextCodec::codecForName("IBM 866"));
        output << "This is a Quazip test..." << endl;
        QString zipPath = "C:\\Users\\cobra\\Downloads\\22598.200_amd64_en-us_professional_7405f8e8_convert.zip";
        QString downloadsFolder = "C:\\Users\\cobra\\Downloads\\22598.200_amd64_en-us_professional";
        const QStringList extractedDir = JlCompress::extractDir(zipPath, downloadsFolder);
    
        if (!extractedDir.isEmpty()) {
            output << "Is empty(): " << "No" << endl;
        } else {
            output << "Is empty(): " << "Yes" << endl;
        }
    
        for (QString extractedFileName : extractedDir) {
            output << "Extracting: " << extractedFileName << endl;
        }
    
        system("Pause");
        return 0;
    }
    

    I have used these commands to build QuaZip statically:

    cmake -DCMAKE_BUILD_TYPE="Debug" -DCMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDebug" -DBUILD_SHARED_LIBS=OFF -S . -B C:/ZipDev/quazip-1.3/msvc2019/static/x86/debug -D QUAZIP_QT_MAJOR_VERSION=5 "-DCMAKE_PREFIX_PATH=C:/Qt/5.9.9/msvc2019" -DZLIB_INCLUDE_DIR="C:/ZipDev/zlib-win-build-1.2.12" -DZLIB_LIBRARY="C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/Debug/libz-static.lib" -G "Visual Studio 16 2019" -A "Win32"
    
    cmake --build C:/ZipDev/quazip-1.3/msvc2019/static/x86/debug --config Debug
    

    Also, I have checked the QuaZip library - quazip1-qt5d.lib using lib /list and dumpbin /directives.

    C:\ZipDev\quazip-1.3\msvc2019\static\x86\debug\quazip\Debug>lib /list quazip1-qt5d.lib
    Microsoft (R) Library Manager Version 14.29.30143.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    QuaZip.dir\Debug\mocs_compilation_Debug.obj
    QuaZip.dir\Debug\unzip.obj
    QuaZip.dir\Debug\zip.obj
    QuaZip.dir\Debug\JlCompress.obj
    QuaZip.dir\Debug\qioapi.obj
    QuaZip.dir\Debug\quaadler32.obj
    QuaZip.dir\Debug\quachecksum32.obj
    QuaZip.dir\Debug\quacrc32.obj
    QuaZip.dir\Debug\quagzipfile.obj
    QuaZip.dir\Debug\quaziodevice.obj
    QuaZip.dir\Debug\quazip.obj
    QuaZip.dir\Debug\quazipdir.obj
    QuaZip.dir\Debug\quazipfile.obj
    QuaZip.dir\Debug\quazipfileinfo.obj
    QuaZip.dir\Debug\quazipnewinfo.obj
    
    C:\ZipDev\quazip-1.3\msvc2019\static\x86\debug\quazip\Debug>
    
    C:\ZipDev\quazip-1.3\msvc2019\static\x86\debug\quazip\Debug>dumpbin /directives quazip1-qt5d.lib
    Microsoft (R) COFF/PE Dumper Version 14.29.30143.0
    Copyright (C) Microsoft Corporation.  All rights reserved.
    
    
    Dump of file quazip1-qt5d.lib
    
    File Type: LIBRARY
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
       Linker Directives
       -----------------
       /FAILIFMISMATCH:_CRT_STDIO_ISO_WIDE_SPECIFIERS=0
       /FAILIFMISMATCH:_MSC_VER=1900
       /FAILIFMISMATCH:_ITERATOR_DEBUG_LEVEL=2
       /FAILIFMISMATCH:RuntimeLibrary=MTd_StaticDebug
       /DEFAULTLIB:libcpmtd
       /DEFAULTLIB:LIBCMTD
       /DEFAULTLIB:OLDNAMES
    
      Summary
    
              28 .CRT$XCU
              6C .bss
            3150 .chks64
              6E .data
             1B8 .data$rs
           CA550 .debug$S
             654 .debug$T
             CD1 .drectve
            6A85 .rdata
             46A .rdata$r
              3C .rtc$IMZ
              3C .rtc$TMZ
             2B8 .sxdata
             12C .text$di
           2A606 .text$mn
            2CD6 .text$x
             67C .voltbl
            2FA4 .xdata$x
    
    C:\ZipDev\quazip-1.3\msvc2019\static\x86\debug\quazip\Debug>
    

    The issue only occurs with Quazip static libs, dynamic libs are working well. What could cause such errors with static libs? Thank you.

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      Seems like you forgot to install QuaZip...

      add -DCMAKE_INSTALL_PREFIX="C:/ZipDev/QuaZip" to the first cmake call (the configuration) and, after the build, call cmake --build C:/ZipDev/quazip-1.3/msvc2019/static/x86/debug --config Debug --target install. You will now have the Quazip library installed in C:/ZipDev/QuaZip that you can reference in your .pro file

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      Cobra91151C 1 Reply Last reply
      0
      • VRoninV VRonin

        Seems like you forgot to install QuaZip...

        add -DCMAKE_INSTALL_PREFIX="C:/ZipDev/QuaZip" to the first cmake call (the configuration) and, after the build, call cmake --build C:/ZipDev/quazip-1.3/msvc2019/static/x86/debug --config Debug --target install. You will now have the Quazip library installed in C:/ZipDev/QuaZip that you can reference in your .pro file

        Cobra91151C Offline
        Cobra91151C Offline
        Cobra91151
        wrote on last edited by
        #3

        @VRonin

        I have tried your solution but it still leads to these linking errors.

        .pro file:

        QT -= gui
        CONFIG += c++latest console static
        CONFIG -= app_bundle
        
        # You can make your code fail to compile if it uses deprecated APIs.
        # In order to do so, uncomment the following line.
        #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
        
        SOURCES += \
                main.cpp
        
        # Default rules for deployment.
        #qnx: target.path = /tmp/$${TARGET}/bin
        #else: unix:!android: target.path = /opt/$${TARGET}/bin
        #!isEmpty(target.path): INSTALLS += target
        MOC_DIR = ./resources/moc
        OBJECTS_DIR = ./resources/objects
        RCC_DIR = ./resources/resource
        DEFINES += QUAZIP_STATIC
        INCLUDEPATH += "C:/ZipDev/QuaZip/include/QuaZip-Qt5-1.3/quazip"
        INCLUDEPATH += "C:/ZipDev/zlib-win-build-1.2.12"
        
        CONFIG(debug, debug|release) {
            DESTDIR = $$OUT_PWD/debug
            LIBS += -L"C:/ZipDev/QuaZip/lib" -lquazip1-qt5d
            LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/Debug" -llibz-static
        }
        
        #QMAKE_POST_LINK = $$(QTDIR)/bin/windeployqt.exe $$shell_quote($$DESTDIR/$$shell_quote($$TARGET).exe) --no-compiler-runtime
        

        Full error log: https://pastebin.com/raw/GL0tK7xV

        1 Reply Last reply
        0
        • VRoninV Offline
          VRoninV Offline
          VRonin
          wrote on last edited by
          #4

          unresolved external symbol "__declspec(dllimport)

          Seems like it's trying to link QuaZip dinamically, ignoring DEFINES += QUAZIP_STATIC

          What's the content of C:/ZipDev/QuaZip and its subfolders now?

          "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
          ~Napoleon Bonaparte

          On a crusade to banish setIndexWidget() from the holy land of Qt

          Cobra91151C 1 Reply Last reply
          0
          • VRoninV VRonin

            unresolved external symbol "__declspec(dllimport)

            Seems like it's trying to link QuaZip dinamically, ignoring DEFINES += QUAZIP_STATIC

            What's the content of C:/ZipDev/QuaZip and its subfolders now?

            Cobra91151C Offline
            Cobra91151C Offline
            Cobra91151
            wrote on last edited by Cobra91151
            #5

            @VRonin

            Yes, I think it ignores the DEFINES += QUAZIP_STATIC and links to dynamic libs for some reason.

            The content of C:/ZipDev/QuaZip folder: QuaZip content.gif

            VRoninV 1 Reply Last reply
            0
            • Cobra91151C Cobra91151

              @VRonin

              Yes, I think it ignores the DEFINES += QUAZIP_STATIC and links to dynamic libs for some reason.

              The content of C:/ZipDev/QuaZip folder: QuaZip content.gif

              VRoninV Offline
              VRoninV Offline
              VRonin
              wrote on last edited by
              #6

              @Cobra91151 said in Quazip-1.3 static linking issue:

              The content of C:/ZipDev/QuaZip folder:

              Looks good.

              #include "JlCompress.h"

              Did you try to unpack QuaZip directly in your source code? Do you have another instance of JlCompress.h in your source tree? If so delete it and also change it to #include <JlCompress.h> just in case

              "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
              ~Napoleon Bonaparte

              On a crusade to banish setIndexWidget() from the holy land of Qt

              Cobra91151C 2 Replies Last reply
              0
              • VRoninV VRonin

                @Cobra91151 said in Quazip-1.3 static linking issue:

                The content of C:/ZipDev/QuaZip folder:

                Looks good.

                #include "JlCompress.h"

                Did you try to unpack QuaZip directly in your source code? Do you have another instance of JlCompress.h in your source tree? If so delete it and also change it to #include <JlCompress.h> just in case

                Cobra91151C Offline
                Cobra91151C Offline
                Cobra91151
                wrote on last edited by
                #7

                @VRonin

                No, my project source code is available: C:\Users\cobra\Documents\Projects\CPP\QuaZipTest
                QuaZip is installed: C:\ZipDev\QuaZip
                I have only 1 instance of JlCompress in the source tree, please check out the following screenshot:

                2022-04-20_132140.png

                I changed to <JlCompress.h> but it still displays these errors.

                1 Reply Last reply
                0
                • VRoninV VRonin

                  @Cobra91151 said in Quazip-1.3 static linking issue:

                  The content of C:/ZipDev/QuaZip folder:

                  Looks good.

                  #include "JlCompress.h"

                  Did you try to unpack QuaZip directly in your source code? Do you have another instance of JlCompress.h in your source tree? If so delete it and also change it to #include <JlCompress.h> just in case

                  Cobra91151C Offline
                  Cobra91151C Offline
                  Cobra91151
                  wrote on last edited by Cobra91151
                  #8

                  @VRonin

                  I have tried to unpack QuaZip directly to the source code:

                  2022-04-20_133628.png

                  .pro file:
                  QT -= gui
                  CONFIG += c++latest console static
                  CONFIG -= app_bundle
                  
                  # You can make your code fail to compile if it uses deprecated APIs.
                  # In order to do so, uncomment the following line.
                  #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
                  
                  SOURCES += \
                          main.cpp
                  
                  # Default rules for deployment.
                  #qnx: target.path = /tmp/$${TARGET}/bin
                  #else: unix:!android: target.path = /opt/$${TARGET}/bin
                  #!isEmpty(target.path): INSTALLS += target
                  MOC_DIR = ./resources/moc
                  OBJECTS_DIR = ./resources/objects
                  RCC_DIR = ./resources/resource
                  DEFINES += QUAZIP_STATIC
                  #INCLUDEPATH += "C:/ZipDev/QuaZip/include/QuaZip-Qt5-1.3/quazip"
                  #INCLUDEPATH += "C:/ZipDev/zlib-win-build-1.2.12"
                  
                  CONFIG(debug, debug|release) {
                      DESTDIR = $$OUT_PWD/debug
                      LIBS += -L"C:/Users/cobra/Documents/Projects/CPP/QuaZipTest" -lquazip1-qt5d
                      LIBS += -L"C:/ZipDev/zlib-win-build-1.2.12/build-VS2019-MT/Debug" -llibz-static
                  }
                  
                  #QMAKE_POST_LINK = $$(QTDIR)/bin/windeployqt.exe $$shell_quote($$DESTDIR/$$shell_quote($$TARGET).exe) --no-compiler-runtime
                  
                  HEADERS += \
                      JlCompress.h \
                      ioapi.h \
                      minizip_crypt.h \
                      quaadler32.h \
                      quachecksum32.h \
                      quacrc32.h \
                      quagzipfile.h \
                      quaziodevice.h \
                      quazip.h \
                      quazip_global.h \
                      quazip_qt_compat.h \
                      quazipdir.h \
                      quazipfile.h \
                      quazipfileinfo.h \
                      quazipnewinfo.h \
                      unzip.h \
                      zconf.h \
                      zip.h \
                      zlib.h
                  

                  The same issues are still exists. Compilation log: https://pastebin.com/raw/sPKErHen

                  1 Reply Last reply
                  0
                  • Cobra91151C Offline
                    Cobra91151C Offline
                    Cobra91151
                    wrote on last edited by
                    #9

                    I have an idea. When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                    It produces the following output:

                    -- Selecting Windows SDK version 10.0.22000.0 to target Windows 10.0.19044.
                    -- The C compiler identification is MSVC 19.29.30143.0
                    -- The CXX compiler identification is MSVC 19.29.30143.0
                    

                    So, I will try to build it using VS 2022: -G "Visual Studio 17 2022" -A "Win32" to check for such issues.

                    1 Reply Last reply
                    0
                    • VRoninV Offline
                      VRoninV Offline
                      VRonin
                      wrote on last edited by
                      #10

                      @Cobra91151 said in Quazip-1.3 static linking issue:

                      I have tried to unpack QuaZip directly to the source code:

                      No, that's a mess, please revert.

                      When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                      I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                      In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                      ~Napoleon Bonaparte

                      On a crusade to banish setIndexWidget() from the holy land of Qt

                      Cobra91151C 4 Replies Last reply
                      0
                      • VRoninV VRonin

                        @Cobra91151 said in Quazip-1.3 static linking issue:

                        I have tried to unpack QuaZip directly to the source code:

                        No, that's a mess, please revert.

                        When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                        I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                        In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                        Cobra91151C Offline
                        Cobra91151C Offline
                        Cobra91151
                        wrote on last edited by
                        #11

                        @VRonin

                        I know, it is the mess. That's why I always linking instead of unpacking everything to the source. Actually, this is the brand new project which I have created to test Quazip because in my real project it leads to the same issues. Previously, I have used the quazip-0.9.1 and it worked without issue. This issue is only with Quazip-1.3. I do not think it is related to the program. I think, something is wrong with Quazip static library. Anyway, I will try my and your solution: -G"NMake Makefiles" and reply soon.

                        1 Reply Last reply
                        0
                        • VRoninV VRonin

                          @Cobra91151 said in Quazip-1.3 static linking issue:

                          I have tried to unpack QuaZip directly to the source code:

                          No, that's a mess, please revert.

                          When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                          I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                          In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                          Cobra91151C Offline
                          Cobra91151C Offline
                          Cobra91151
                          wrote on last edited by
                          #12

                          @VRonin

                          I have tried both solutions with VS 2022 and NMake Makefiles, but it still displays these linking errors. So, I have found this old article: https://forum.qt.io/topic/8492/solved-cannot-get-quazip-test-to-work/2, it maked as solved but I can not find the actual post with a solution. Any ideas?

                          1 Reply Last reply
                          0
                          • VRoninV VRonin

                            @Cobra91151 said in Quazip-1.3 static linking issue:

                            I have tried to unpack QuaZip directly to the source code:

                            No, that's a mess, please revert.

                            When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                            I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                            In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                            Cobra91151C Offline
                            Cobra91151C Offline
                            Cobra91151
                            wrote on last edited by
                            #13

                            @VRonin

                            QuaZip VS solution uses by default: Use Multi-Byte Character Set and it could be changed to: Use Unicode Character Set or Not Set.
                            When I try to add my test project using VS 2019 -> Qt extension, it displays the charset as: Not Set.
                            So, I think it could be Use Unicode Character Set or better to set the Not Set option for this QuaZip static library when building QuaZip lib.

                            1 Reply Last reply
                            0
                            • VRoninV VRonin

                              @Cobra91151 said in Quazip-1.3 static linking issue:

                              I have tried to unpack QuaZip directly to the source code:

                              No, that's a mess, please revert.

                              When selecting cmake compiler: -G "Visual Studio 16 2019" -A "Win32"

                              I wouldn't bother, just use -G"NMake Makefiles", it's a bit slower but QuaZip is not a big project and that will automatically select the compiler you are using and you won't even need to specify --config Debug.

                              In any case, this does not seem like a problem in the QuaZip build side. The library is installed correctly so that side worked, the problem is in your program using it. Can you try with a brand new project?

                              Cobra91151C Offline
                              Cobra91151C Offline
                              Cobra91151
                              wrote on last edited by
                              #14

                              @VRonin

                              No, it does not work. I have tried a lot of different solutions but it still fails with linking issues. This is the library issue. So, I do not have any options left but to drop QuaZip and create my own library.

                              VRoninV 1 Reply Last reply
                              0
                              • Cobra91151C Cobra91151

                                @VRonin

                                No, it does not work. I have tried a lot of different solutions but it still fails with linking issues. This is the library issue. So, I do not have any options left but to drop QuaZip and create my own library.

                                VRoninV Offline
                                VRoninV Offline
                                VRonin
                                wrote on last edited by
                                #15

                                @Cobra91151 said in Quazip-1.3 static linking issue:

                                drop QuaZip and create my own library

                                That's a giant leap.

                                1. try compilying it dinamically and use it as a dll, why not
                                2. consider alternatives, like KArchive

                                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                                ~Napoleon Bonaparte

                                On a crusade to banish setIndexWidget() from the holy land of Qt

                                Cobra91151C 1 Reply Last reply
                                0
                                • VRoninV VRonin

                                  @Cobra91151 said in Quazip-1.3 static linking issue:

                                  drop QuaZip and create my own library

                                  That's a giant leap.

                                  1. try compilying it dinamically and use it as a dll, why not
                                  2. consider alternatives, like KArchive
                                  Cobra91151C Offline
                                  Cobra91151C Offline
                                  Cobra91151
                                  wrote on last edited by
                                  #16

                                  @VRonin

                                  Using DLL is not an option in my case because it must be only .exe file for installer. I do not think KArchive is worth trying since it could be the same issue at some point. I prefer code it by my own and have a full control over it. Simple lib to zip/unzip archives wrapper for Qt. Thanks.

                                  1 Reply Last reply
                                  0
                                  • Cobra91151C Offline
                                    Cobra91151C Offline
                                    Cobra91151
                                    wrote on last edited by
                                    #17

                                    Hello!

                                    I have created my own CZip library which adds content to archive and extracts it.
                                    The issue is resolved.

                                    1 Reply Last reply
                                    0

                                    • Login

                                    • Login or register to search.
                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • Users
                                    • Groups
                                    • Search
                                    • Get Qt Extensions
                                    • Unsolved