Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Special Interest Groups
  3. C++ Gurus
  4. How to solve this error -> undefined reference to `__imp__ZN13QSvgGeneratorC1Ev'
Qt 6.12 LTS is out! See what's new in the release blog

How to solve this error -> undefined reference to `__imp__ZN13QSvgGeneratorC1Ev'

Scheduled Pinned Locked Moved Unsolved C++ Gurus
11 Posts 2 Posters 4.9k 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.
  • F Offline
    F Offline
    FaraN
    wrote on last edited by
    #1

    I am trying to get Class Diagrams in svg format. I have created headers and included them correctly. However, at run-time this error comes. How to solve this. Help my c++ gurus.

    JonBJ 1 Reply Last reply
    0
    • F FaraN

      I am trying to get Class Diagrams in svg format. I have created headers and included them correctly. However, at run-time this error comes. How to solve this. Help my c++ gurus.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by JonB
      #2

      @FaraN said in How to solve this error -> undefined reference to `__imp__ZN13QSvgGeneratorC1Ev':
      Hi and welcome.

      I am trying to get Class Diagrams in svg format.

      What does this mean? Something in a program of your own, something in Qt Creator, something else?

      However, at run-time this error comes

      So you are saying this this comes up at run-time (when you run your application), not at link time (during the build)?

      1 Reply Last reply
      0
      • F Offline
        F Offline
        FaraN
        wrote on last edited by
        #3

        Yes in Qt Creator, when i press RUN, after building error comes.
        ->
        187ac277-0567-43c1-922e-b6b835d72333-image.png

        JonBJ 1 Reply Last reply
        0
        • F Offline
          F Offline
          FaraN
          wrote on last edited by
          #4

          this is the code:

          //Save file as SVG
          
          QString path = QFileDialog::getSaveFileName(w,("Save as image"), "/demo.svg", ("SVG file (*.svg)"));
          
          if (path.isEmpty())
              return;
          temp_img.setFileName(path);
          
          //temp_img.setViewBox(QRect(0, 0, 1000, 1000));
          
          temp_img.setSize(QSize(2000, 2000));
          
          1 Reply Last reply
          0
          • F FaraN

            Yes in Qt Creator, when i press RUN, after building error comes.
            ->
            187ac277-0567-43c1-922e-b6b835d72333-image.png

            JonBJ Offline
            JonBJ Offline
            JonB
            wrote on last edited by JonB
            #5

            @FaraN
            So I don't think this is "after building", I think this is during building at the link stage. Try just doing a build in Creator, not a run, and verify you get this error.

            It looks like you are missing a library for this "SVG Generator", or possibly have not specified it correctly, or it's the wrong version/compiler, or other possibilities.

            You need to state things like: what version of Qt, what platform, what compiler, where this SvgGenerator stuff is supposed to come from (is it the QSvgGenerator Class?), whether you build Qt yourself or got it from somewhere? And most important show your project's .pro file so we can see how you are trying to link?

            If you are indeed using the QSvgGenerator Class, what did you do about the qmake: QT += svg from the doc page?

            1 Reply Last reply
            0
            • F Offline
              F Offline
              FaraN
              wrote on last edited by
              #6

              QT += core gui

              greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

              CONFIG += c++11

              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 +=
              ../Source/array.cpp
              ../Source/button.cpp
              ../Source/class.cpp
              ../Source/constructor.cpp
              ../Source/container.cpp
              ../Source/function.cpp
              ../Source/functions.cpp
              ../Source/globals.cpp
              ../Source/variable.cpp
              ../Source/win_main.cpp
              main.cpp

              HEADERS +=
              ../Headers/array.h
              ../Headers/button.h
              ../Headers/class.h
              ../Headers/constructor.h
              ../Headers/container.h
              ../Headers/function.h
              ../Headers/functions.h
              ../Headers/globals.h
              ../Headers/variable.h
              ../Headers/win_main.h

              FORMS +=

              Default rules for deployment.

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

              JonBJ 1 Reply Last reply
              0
              • F FaraN

                QT += core gui

                greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

                CONFIG += c++11

                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 +=
                ../Source/array.cpp
                ../Source/button.cpp
                ../Source/class.cpp
                ../Source/constructor.cpp
                ../Source/container.cpp
                ../Source/function.cpp
                ../Source/functions.cpp
                ../Source/globals.cpp
                ../Source/variable.cpp
                ../Source/win_main.cpp
                main.cpp

                HEADERS +=
                ../Headers/array.h
                ../Headers/button.h
                ../Headers/class.h
                ../Headers/constructor.h
                ../Headers/container.h
                ../Headers/function.h
                ../Headers/functions.h
                ../Headers/globals.h
                ../Headers/variable.h
                ../Headers/win_main.h

                FORMS +=

                Default rules for deployment.

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

                JonBJ Offline
                JonBJ Offline
                JonB
                wrote on last edited by JonB
                #7

                @FaraN
                Well you showed your .pro but didn't answer any of the other questions.....

                Anyway, your error message implies to me you are using that QSvgGenerator Class, from whatever route, and I said:

                If you are indeed using the QSvgGenerator Class, what did you do about the qmake: QT += svg from the doc page?

                So try changing to first line to

                QT += core gui svg
                

                Clear out build output directory and try re-running qmake and rebuilding from scratch. Does that help?

                1 Reply Last reply
                1
                • F Offline
                  F Offline
                  FaraN
                  wrote on last edited by
                  #8

                  Respected Sir, I'm doing it. I'll tell you in 10-15 min.
                  sorry I can only msg once in 10 minutes. Qt forum is restricting me.

                  1 Reply Last reply
                  0
                  • F Offline
                    F Offline
                    FaraN
                    wrote on last edited by
                    #9

                    Brother, I love you. Bundle of thanks. It worked. 100%

                    please provide your linkedin. <3

                    JonBJ 1 Reply Last reply
                    0
                    • F FaraN

                      Brother, I love you. Bundle of thanks. It worked. 100%

                      please provide your linkedin. <3

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on last edited by JonB
                      #10

                      @FaraN
                      I appreciate your love, but will accept it anonymously/from a distance. ;-)

                      1 Reply Last reply
                      3
                      • F Offline
                        F Offline
                        FaraN
                        wrote on last edited by
                        #11

                        @JonB thanks again. <3

                        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