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. Problems with QuaZip
Qt 6.11 is out! See what's new in the release blog

Problems with QuaZip

Scheduled Pinned Locked Moved Solved General and Desktop
14 Posts 3 Posters 8.3k Views 1 Watching
  • 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.
  • K Offline
    K Offline
    Kamba
    wrote on last edited by
    #5

    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 windows

    win32 {
        LIBS += -L$$PWD/quazip -lzdll
    }
    

    W7 64bit, QT 5.6

    kshegunovK 1 Reply Last reply
    0
    • K Kamba

      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 windows

      win32 {
          LIBS += -L$$PWD/quazip -lzdll
      }
      

      W7 64bit, QT 5.6

      kshegunovK Offline
      kshegunovK Offline
      kshegunov
      Moderators
      wrote on last edited by kshegunov
      #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.

      @raven-worx

      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.

      Read and abide by the Qt Code of Conduct

      K 1 Reply Last reply
      0
      • kshegunovK kshegunov

        @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.

        @raven-worx

        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.

        K Offline
        K Offline
        Kamba
        wrote on last edited by
        #7

        @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.

        kshegunovK 1 Reply Last reply
        0
        • K Kamba

          @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.

          kshegunovK Offline
          kshegunovK Offline
          kshegunov
          Moderators
          wrote on last edited by kshegunov
          #8

          @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.

          Read and abide by the Qt Code of Conduct

          K 1 Reply Last reply
          0
          • kshegunovK kshegunov

            @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.

            K Offline
            K Offline
            Kamba
            wrote on last edited by
            #9

            @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

            kshegunovK 1 Reply Last reply
            0
            • K Kamba

              @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

              kshegunovK Offline
              kshegunovK Offline
              kshegunov
              Moderators
              wrote on last edited by
              #10

              @Kamba

              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.

              Read and abide by the Qt Code of Conduct

              K 1 Reply Last reply
              0
              • kshegunovK kshegunov

                @Kamba

                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.

                K Offline
                K Offline
                Kamba
                wrote on last edited by
                #11

                @kshegunov said:

                @Kamba

                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?

                kshegunovK 1 Reply Last reply
                0
                • K Kamba

                  @kshegunov said:

                  @Kamba

                  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?

                  kshegunovK Offline
                  kshegunovK Offline
                  kshegunov
                  Moderators
                  wrote on last edited by kshegunov
                  #12

                  @Kamba

                  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.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  1
                  • K Offline
                    K Offline
                    Kamba
                    wrote on last edited by
                    #13

                    Now I got it working. Built QuaZip on windows and linux.
                    added to .pro file

                    INCLUDEPATH += $$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?

                    kshegunovK 1 Reply Last reply
                    1
                    • K Kamba

                      Now I got it working. Built QuaZip on windows and linux.
                      added to .pro file

                      INCLUDEPATH += $$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?

                      kshegunovK Offline
                      kshegunovK Offline
                      kshegunov
                      Moderators
                      wrote on last edited by
                      #14

                      @Kamba said:

                      So I guess this is it?

                      Indeed, this is it.
                      Cheers!

                      Read and abide by the Qt Code of Conduct

                      1 Reply Last reply
                      1

                      • Login

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