How to solve this error -> undefined reference to `__imp__ZN13QSvgGeneratorC1Ev'
-
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.
@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)?
-
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)); -
@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
SvgGeneratorstuff 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.profile 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 += svgfrom the doc page? -
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.cppHEADERS +=
../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.hFORMS +=
Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target -
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.cppHEADERS +=
../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.hFORMS +=
Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target@FaraN
Well you showed your.probut 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 svgClear out build output directory and try re-running
qmakeand rebuilding from scratch. Does that help?
