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 - 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 6.4k 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 Offline
    FluentCodingF Offline
    FluentCoding
    wrote on last edited by FluentCoding
    #1

    Hey!

    I have a problem when I want to add QuaZip to my project. I get 100 "undefined reference" errors, which is a result of a linking problem iirc.

    include(util/singleApplication/singleapplication.pri)
    include(util/quazip-0.9.1/quazip.pri)
    LIBS += -lz
    
    QT       += core gui network
    
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    
    CONFIG += c++17
    
    # The following define makes your compiler emit warnings if you use
    # any Qt feature that has been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    DEFINES += QAPPLICATION_CLASS=QApplication
    
    # You can also make your code fail to compile if it uses deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
        const/commonfilepaths.cpp \
        const/commonfolderpaths.cpp \
        const/commonmessageboxes.cpp \
        const/sources.cpp \
        fetcher/builddownloadinfofetcher.cpp \
        fetcher/buildinfofetcher.cpp \
        dialog/buildpathdialog.cpp \
        dialog/downloadbuildsdialog.cpp \
        util/buildpathsmanager.cpp \
        util/dolphinbuildscanner.cpp \
        util/qeasyfile.cpp \
        util/stylesheetloader.cpp \
        view/buildoptionsview.cpp \
        view/buildtreeview.cpp \
        main.cpp \
        mainwindow.cpp \
        util/filedownloader.cpp \
        util/hashfetcher.cpp \
        view/generaloptionsview.cpp
    
    HEADERS += \
        const/commonfilepaths.h \
        const/commonfolderpaths.h \
        const/commonmessageboxes.h \
        const/sources.h \
        fetcher/builddownloadinfofetcher.h \
        fetcher/buildinfofetcher.h \
        dialog/buildpathdialog.h \
        dialog/downloadbuildsdialog.h \
        struct/buildpathentry.h \
        struct/dolphinbuild.h \
        util/buildpathsmanager.h \
        util/dolphinbuildscanner.h \
        util/qeasyfile.h \
        view/buildoptionsview.h \
        view/buildtreeview.h \
        mainwindow.h \
        util/stylesheetloader.h \
        util/filedownloader.h \
        util/hashfetcher.h \
        view/generaloptionsview.h
    
    FORMS += \
        dialog/buildpathdialog.ui \
        dialog/downloadbuildsdialog.ui \
        mainwindow.ui
    
    RESOURCES += resources.qrc
    

    What am I doing wrong? The lineLIBS += -lz should import the integrated zlib dependeny from QT so I don't see what I'm doing wrong here.

    d8df14f7-8681-4e48-803f-a8118b491aea-image.png

    raven-worxR 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 FluentCoding

        Hey!

        I have a problem when I want to add QuaZip to my project. I get 100 "undefined reference" errors, which is a result of a linking problem iirc.

        include(util/singleApplication/singleapplication.pri)
        include(util/quazip-0.9.1/quazip.pri)
        LIBS += -lz
        
        QT       += core gui network
        
        greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
        
        CONFIG += c++17
        
        # The following define makes your compiler emit warnings if you use
        # any Qt feature that has been marked deprecated (the exact warnings
        # depend on your compiler). Please consult the documentation of the
        # deprecated API in order to know how to port your code away from it.
        DEFINES += QT_DEPRECATED_WARNINGS
        DEFINES += QAPPLICATION_CLASS=QApplication
        
        # You can also make your code fail to compile if it uses deprecated APIs.
        # In order to do so, uncomment the following line.
        # You can also select to disable deprecated APIs only up to a certain version of Qt.
        #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
        
        SOURCES += \
            const/commonfilepaths.cpp \
            const/commonfolderpaths.cpp \
            const/commonmessageboxes.cpp \
            const/sources.cpp \
            fetcher/builddownloadinfofetcher.cpp \
            fetcher/buildinfofetcher.cpp \
            dialog/buildpathdialog.cpp \
            dialog/downloadbuildsdialog.cpp \
            util/buildpathsmanager.cpp \
            util/dolphinbuildscanner.cpp \
            util/qeasyfile.cpp \
            util/stylesheetloader.cpp \
            view/buildoptionsview.cpp \
            view/buildtreeview.cpp \
            main.cpp \
            mainwindow.cpp \
            util/filedownloader.cpp \
            util/hashfetcher.cpp \
            view/generaloptionsview.cpp
        
        HEADERS += \
            const/commonfilepaths.h \
            const/commonfolderpaths.h \
            const/commonmessageboxes.h \
            const/sources.h \
            fetcher/builddownloadinfofetcher.h \
            fetcher/buildinfofetcher.h \
            dialog/buildpathdialog.h \
            dialog/downloadbuildsdialog.h \
            struct/buildpathentry.h \
            struct/dolphinbuild.h \
            util/buildpathsmanager.h \
            util/dolphinbuildscanner.h \
            util/qeasyfile.h \
            view/buildoptionsview.h \
            view/buildtreeview.h \
            mainwindow.h \
            util/stylesheetloader.h \
            util/filedownloader.h \
            util/hashfetcher.h \
            view/generaloptionsview.h
        
        FORMS += \
            dialog/buildpathdialog.ui \
            dialog/downloadbuildsdialog.ui \
            mainwindow.ui
        
        RESOURCES += resources.qrc
        

        What am I doing wrong? The lineLIBS += -lz should import the integrated zlib dependeny from QT so I don't see what I'm doing wrong here.

        d8df14f7-8681-4e48-803f-a8118b491aea-image.png

        raven-worxR Offline
        raven-worxR Offline
        raven-worx
        Moderators
        wrote on last edited by
        #2

        @FluentCoding
        maybe your issue is solved by simply rerunning qmake and do a full rebuild?

        --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
        If you have a question please use the forum so others can benefit from the solution in the future

        FluentCodingF 1 Reply Last reply
        0
        • FluentCodingF Offline
          FluentCodingF Offline
          FluentCoding
          wrote on last edited by
          #3
          This post is deleted!
          1 Reply Last reply
          0
          • raven-worxR raven-worx

            @FluentCoding
            maybe your issue is solved by simply rerunning qmake and do a full rebuild?

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

            @raven-worx
            No, it didn't work :( I rebuilt it and also tried to create a Release Build besides a Debug one but the same error still occurs.

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

              Can anyone help me? :/

              B 1 Reply Last reply
              0
              • mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #6

                @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 1 Reply Last reply
                1
                • 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 Online
                                          Christian EhrlicherC Online
                                          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

                                            • Login

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