Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QuaZip - Undefined Reference
Qt 6.11 is out! See what's new in the release blog

QuaZip - Undefined Reference

Scheduled Pinned Locked Moved Solved General and Desktop
33 Posts 5 Posters 12.1k Views 2 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.
  • FluentCodingF FluentCoding

    Can anyone help me? :/

    B Offline
    B Offline
    Bonnie
    wrote on last edited by Bonnie
    #7

    @FluentCoding
    I think this project is supposed to be linked as library, not directly added to other projects.
    And what you are doing is something like static linking. So I think you should add

    DEFINES += QUAZIP_STATIC
    

    to your .pro file.
    Otherwide the headers will think the classes as "dllimport"

    1 Reply Last reply
    1
    • mrjjM mrjj

      @FluentCoding said in QuaZip - Undefined Reference:

      QuaZip

      Hi
      Did you compile all of QuaZip yourself so we know the compiler used for app and for lib is the same and therefore compatible?
      OR did you download a precompiled lib and try to link to that ?

      Often undefined reference comes down to
      32/64 bit mismatch
      compiler mismatch
      It simply don't find it

      You do have zlib installed in a normal system place for your platform ?

      FluentCodingF Offline
      FluentCodingF Offline
      FluentCoding
      wrote on last edited by FluentCoding
      #8

      @mrjj https://github.com/stachenov/quazip I've downloaded the source and just included it to the project. I also tried to build it but I got some errors. I also have installed zlib but it didn't work, I've uninstalled it. I then added the line LIBS += -lz so that QT's internal zlib library gets added but that didn't work either.

      @Bonnie I have already tried it and it didn't work either. It also didn't remove the dllimport warnings.

      mrjjM 1 Reply Last reply
      0
      • FluentCodingF FluentCoding

        @mrjj https://github.com/stachenov/quazip I've downloaded the source and just included it to the project. I also tried to build it but I got some errors. I also have installed zlib but it didn't work, I've uninstalled it. I then added the line LIBS += -lz so that QT's internal zlib library gets added but that didn't work either.

        @Bonnie I have already tried it and it didn't work either. It also didn't remove the dllimport warnings.

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #9

        @FluentCoding

        Windows or linux ?

        FluentCodingF 1 Reply Last reply
        0
        • mrjjM mrjj

          @FluentCoding

          Windows or linux ?

          FluentCodingF Offline
          FluentCodingF Offline
          FluentCoding
          wrote on last edited by
          #10

          @mrjj Win10

          mrjjM 1 Reply Last reply
          0
          • FluentCodingF FluentCoding

            @mrjj Win10

            mrjjM Offline
            mrjjM Offline
            mrjj
            Lifetime Qt Champion
            wrote on last edited by
            #11

            @FluentCoding
            Ok did you see
            "Also note that you may or may not need to define ZLIB_WINAPI (qmake DEFINES+=ZLIB_WINAPI) when linking to zlib on Windows, depending on how zlib was built (generally, if using zlibwapi.dll, this define is needed)."

            From where did you install zlib ?

            FluentCodingF 1 Reply Last reply
            1
            • mrjjM mrjj

              @FluentCoding
              Ok did you see
              "Also note that you may or may not need to define ZLIB_WINAPI (qmake DEFINES+=ZLIB_WINAPI) when linking to zlib on Windows, depending on how zlib was built (generally, if using zlibwapi.dll, this define is needed)."

              From where did you install zlib ?

              FluentCodingF Offline
              FluentCodingF Offline
              FluentCoding
              wrote on last edited by
              #12

              @mrjj From their homepage (the *.msi installer)

              mrjjM 1 Reply Last reply
              0
              • FluentCodingF FluentCoding

                @mrjj From their homepage (the *.msi installer)

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #13

                @FluentCoding
                https://zlib.net/ ?
                and then some of external links ?

                I wondering if its for older compiler if not source code.

                1 Reply Last reply
                0
                • FluentCodingF Offline
                  FluentCodingF Offline
                  FluentCoding
                  wrote on last edited by
                  #14

                  No, don't think so. Have you ever worked with QuaZip? Or are you aware of any good alternative? I was unlucky with KArchive too.

                  mrjjM 1 Reply Last reply
                  0
                  • FluentCodingF FluentCoding

                    No, don't think so. Have you ever worked with QuaZip? Or are you aware of any good alternative? I was unlucky with KArchive too.

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #15

                    @FluentCoding
                    I only seen it here on forums. I compiled it once in linux but not tried on
                    Windows hence my questions to see what zlib you used.
                    if binary, i think its a compiler mismatch issue you are seeing.

                    I used
                    https://github.com/kuba--/zip
                    which is very small and easy to use/compile but
                    only support zip files.
                    But for my use case it was ok and speed and compression is super.

                    1 Reply Last reply
                    2
                    • FluentCodingF Offline
                      FluentCodingF Offline
                      FluentCoding
                      wrote on last edited by
                      #16

                      @mrjj Thats perfect, thanks! I only need it for zip iirc.

                      mrjjM 1 Reply Last reply
                      0
                      • FluentCodingF FluentCoding

                        @mrjj Thats perfect, thanks! I only need it for zip iirc.

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #17

                        @FluentCoding
                        Ok :)
                        Do note.

                        It has no recursive function to add all files in all folders but using Qt that is not hard to add.

                        I tested it with a 1 GB zip file which it handled ok. I cannot say for larger.

                        It does not support 64 bit zip file so if you get yours from an external source it might be an issue.

                        1 Reply Last reply
                        0
                        • FluentCodingF Offline
                          FluentCodingF Offline
                          FluentCoding
                          wrote on last edited by
                          #18

                          Oh aight. Btw is it possible to open a zip file from a QByteArray (from memory generally)? @mrjj

                          mrjjM 1 Reply Last reply
                          0
                          • Christian EhrlicherC Offline
                            Christian EhrlicherC Offline
                            Christian Ehrlicher
                            Lifetime Qt Champion
                            wrote on last edited by
                            #19

                            @FluentCoding said in QuaZip - Undefined Reference:

                            Btw is it possible to open a zip file from a QByteArray (from memory generally)?

                            yes

                            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                            Visit the Qt Academy at https://academy.qt.io/catalog

                            FluentCodingF 1 Reply Last reply
                            1
                            • Christian EhrlicherC Christian Ehrlicher

                              @FluentCoding said in QuaZip - Undefined Reference:

                              Btw is it possible to open a zip file from a QByteArray (from memory generally)?

                              yes

                              FluentCodingF Offline
                              FluentCodingF Offline
                              FluentCoding
                              wrote on last edited by
                              #20

                              @Christian-Ehrlicher How, if I may ask? I haven't found the appropiate method for that.

                              1 Reply Last reply
                              0
                              • FluentCodingF FluentCoding

                                Oh aight. Btw is it possible to open a zip file from a QByteArray (from memory generally)? @mrjj

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #21

                                @FluentCoding
                                Hi
                                Yes it can be both memory and file-based
                                see section
                                Extract a zip entry into memory using callback.

                                FluentCodingF 1 Reply Last reply
                                0
                                • FluentCodingF Offline
                                  FluentCodingF Offline
                                  FluentCoding
                                  wrote on last edited by
                                  #22
                                  This post is deleted!
                                  1 Reply Last reply
                                  0
                                  • mrjjM mrjj

                                    @FluentCoding
                                    Hi
                                    Yes it can be both memory and file-based
                                    see section
                                    Extract a zip entry into memory using callback.

                                    FluentCodingF Offline
                                    FluentCodingF Offline
                                    FluentCoding
                                    wrote on last edited by FluentCoding
                                    #23

                                    @mrjj Thanks but I meant from memory, not into memory.

                                    mrjjM 1 Reply Last reply
                                    0
                                    • FluentCodingF FluentCoding

                                      @mrjj Thanks but I meant from memory, not into memory.

                                      mrjjM Offline
                                      mrjjM Offline
                                      mrjj
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #24

                                      @FluentCoding
                                      if you mean
                                      Can i add a buffer to the zip file as was it a file then yes :)

                                                      auto bytes = QByteArray::fromRawData(reinterpret_cast<const char *>(memory), int(fileSize32Bit));
                                                      zip_entry_write(zip, bytes, fileSize32Bit);
                                      
                                      
                                      1 Reply Last reply
                                      1
                                      • FluentCodingF Offline
                                        FluentCodingF Offline
                                        FluentCoding
                                        wrote on last edited by FluentCoding
                                        #25

                                        @mrjj Alright - (hopefully the) last question: How can I create zip_t object without zip_open, so that i only use zip_entry_write to add the buffer? Should I just create an object of the struct zip_t? Also, should I replace fileSize32Bit with the size of the QByteArray?

                                        mrjjM 1 Reply Last reply
                                        0
                                        • FluentCodingF FluentCoding

                                          @mrjj Alright - (hopefully the) last question: How can I create zip_t object without zip_open, so that i only use zip_entry_write to add the buffer? Should I just create an object of the struct zip_t? Also, should I replace fileSize32Bit with the size of the QByteArray?

                                          mrjjM Offline
                                          mrjjM Offline
                                          mrjj
                                          Lifetime Qt Champion
                                          wrote on last edited by
                                          #26

                                          Hi
                                          I have not tried that but look in zip.c and

                                          struct zip_t *zip_open(const char *zipname, int level, char mode) {
                                          
                                          

                                          I think you can init it up as you like if you follow that code and the various modes + flags.

                                          Yes, fileSize32Bit should be the QByteArray size.

                                          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
                                          • Unsolved