5

I know that this topic has been discussed, but i really can't find a solution for my problem. I want to read data from an XML file with QDomDocument and i get errors of this type:

main.obj:-1: error: LNK2019: unresolved external symbol “__declspec(dllimport) public: class QDomElement __cdecl QDomNode::toElement(void)const “ (__imp_?toElement@QDomNode@@QEBA?AVQDomElement@@XZ) referenced in function “void __cdecl ListElements(class QDomElement,class QString,class QString)” (?ListElements@@YAXVQDomElement@@VQString@@1@Z)

I included

#include <QCoreApplication>
#include <QtXml/QtXml>
#include <QDebug>

and i also added Qt += xml to .pro file

laura
  • 2,085
  • 13
  • 36
  • 68

1 Answers1

11

You need to run qmake after you add modules into the .pro file (that will regenerate the makefile with the correct libraries added and then the linker will find those)

Zlatomir
  • 6,964
  • 3
  • 26
  • 32
  • When you say "run qmake" is this not the same as when i do "rebuild all" in QT Creator? – user1767754 Jul 19 '14 at 16:45
  • It's not the same, qmake generates the makefiles, and the build invokes the compiler and linker to build and link. Rebuild sometimes runs qmake, but sometimes it doesn't detect that it needs to run qmake again and then you need to run it manually and after qmake generate makefile that adds xml module to link step, the build is completed successfully. – Zlatomir Jul 19 '14 at 20:44