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. undefined reference to duckx::Document::Document
Qt 6.11 is out! See what's new in the release blog

undefined reference to duckx::Document::Document

Scheduled Pinned Locked Moved Solved General and Desktop
18 Posts 4 Posters 2.1k 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.
  • kkoehneK Offline
    kkoehneK Offline
    kkoehne
    Moderators
    wrote on last edited by
    #3
    This post is deleted!
    1 Reply Last reply
    0
    • jsulmJ jsulm

      @Toruha Please post text as text, not screen shots.
      Why do you add the headers from that library directly? It is enough to set INCLUDEPATH as ayou're already doing.
      Did you build the library already?

      T Offline
      T Offline
      Toruha
      wrote on last edited by
      #4

      @jsulm I built the library via Cmake and compiled it in Visual Studio 2019. Then I added the library as "External library" referring to https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html.

      jsulmJ 1 Reply Last reply
      0
      • T Toruha

        @jsulm I built the library via Cmake and compiled it in Visual Studio 2019. Then I added the library as "External library" referring to https://doc.qt.io/qtcreator/creator-project-qmake-libraries.html.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #5

        @Toruha What compiler do you use for your Qt application?

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        T 1 Reply Last reply
        0
        • jsulmJ jsulm

          @Toruha What compiler do you use for your Qt application?

          T Offline
          T Offline
          Toruha
          wrote on last edited by
          #6

          @jsulm c++11 console

          T jsulmJ 2 Replies Last reply
          0
          • T Toruha

            @jsulm c++11 console

            T Offline
            T Offline
            Toruha
            wrote on last edited by
            #7

            @Toruha I hope this is what you were asking.

            1 Reply Last reply
            0
            • T Toruha

              I'm trying to add a library to a project. https://github.com/AlexanderVatov/DuckX. Using qmake.
              I encountered the following errors when executing the test code proposed by the author of the library:

              alt text

              .pro file looks like this:

              alt text

              To solve the problem, I tried to rebuild the project.

              T Offline
              T Offline
              Toruha
              wrote on last edited by Toruha
              #8

              Text .pro:

              QT -= gui

              CONFIG += c++11 console
              CONFIG -= app_bundle

              SOURCES +=
              main.cpp

              qnx: target.path = /tmp/$${TARGET}/bin
              else: unix:!android: target.path = /opt/$${TARGET}/bin
              !isEmpty(target.path): INSTALLS += target

              win32:CONFIG(release, debug|release): LIBS += -L$$PWD/duckx/lib/ -lduckx
              else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/duckx/lib/ -lduckxd
              else:unix: LIBS += -L$$PWD/duckx/lib/ -lduckx

              INCLUDEPATH += $$PWD/duckx/include/duckx
              DEPENDPATH += $$PWD/duckx/include/duckx

              INCLUDEPATH += $$PWD/duckx/include/duckx
              HEADERS +=
              constants.hpp
              duckx.hpp
              duckxiterator.hpp
              pugiconfig.hpp
              pugixml.hpp
              zip.h

              1 Reply Last reply
              0
              • kkoehneK Offline
                kkoehneK Offline
                kkoehne
                Moderators
                wrote on last edited by
                #9

                As suggested already by @jsulm , please don't list duckx headers in HEADERS variable.

                Can you paste the actual compiler output (Use Build>Rebuild, and paste the output of 'Comiple Output' pane?)

                1 Reply Last reply
                0
                • Christian EhrlicherC Online
                  Christian EhrlicherC Online
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #10

                  After a short look at the duckx.hpp header file you will see that it lacks the proper import/export macros as described e.g. here. So you can either only build and link the library as static lib or add the correct macros.

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

                  1 Reply Last reply
                  1
                  • T Offline
                    T Offline
                    Toruha
                    wrote on last edited by
                    #11

                    I got a new error trying to return everything back
                    5575e08c-05a1-4c3a-8fc1-dab30f61ae2a-image.png

                    1 Reply Last reply
                    0
                    • T Toruha

                      @jsulm c++11 console

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #12

                      @Toruha said in undefined reference to duckx::Document::Document:

                      c++11 console

                      This doesn't tell me much, really!
                      Did you use the Microsoft compiler (same as in Visual Studio)? Or did you use MinGW?

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      T 1 Reply Last reply
                      0
                      • jsulmJ jsulm

                        @Toruha said in undefined reference to duckx::Document::Document:

                        c++11 console

                        This doesn't tell me much, really!
                        Did you use the Microsoft compiler (same as in Visual Studio)? Or did you use MinGW?

                        T Offline
                        T Offline
                        Toruha
                        wrote on last edited by
                        #13

                        @jsulm MinGW

                        jsulmJ 1 Reply Last reply
                        0
                        • T Toruha

                          @jsulm MinGW

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #14

                          @Toruha You can't mix different compilers like in this case Microsoft compiler and MinGW. You have to build both, the library and your app, with same compiler.

                          But from your screen-shot above it rather looks like you're using Microsoft compiler...

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          T 2 Replies Last reply
                          2
                          • kkoehneK Offline
                            kkoehneK Offline
                            kkoehne
                            Moderators
                            wrote on last edited by
                            #15

                            Right, the _ITERATOR_DEBUG_LEVEL, RuntimeLibrary issues above rather show that you've done a Release build of duckx, but want to use it in a debug build of your app. This won't work; you need to compile both in the same configuration.

                            T 1 Reply Last reply
                            1
                            • jsulmJ jsulm

                              @Toruha You can't mix different compilers like in this case Microsoft compiler and MinGW. You have to build both, the library and your app, with same compiler.

                              But from your screen-shot above it rather looks like you're using Microsoft compiler...

                              T Offline
                              T Offline
                              Toruha
                              wrote on last edited by
                              #16

                              @jsulm I tried to rebuild under Microsoft compiler. What caused these new errors

                              1 Reply Last reply
                              0
                              • jsulmJ jsulm

                                @Toruha You can't mix different compilers like in this case Microsoft compiler and MinGW. You have to build both, the library and your app, with same compiler.

                                But from your screen-shot above it rather looks like you're using Microsoft compiler...

                                T Offline
                                T Offline
                                Toruha
                                wrote on last edited by
                                #17

                                @jsulm Thanks, this solves the original problem

                                1 Reply Last reply
                                0
                                • kkoehneK kkoehne

                                  Right, the _ITERATOR_DEBUG_LEVEL, RuntimeLibrary issues above rather show that you've done a Release build of duckx, but want to use it in a debug build of your app. This won't work; you need to compile both in the same configuration.

                                  T Offline
                                  T Offline
                                  Toruha
                                  wrote on last edited by Toruha
                                  #18

                                  @kkoehne Thanks. Everything works after changing the build type

                                  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