Qt未解析的外部符号LNK2019

lau*_*ura 5 c++ qt

我知道这个话题已经讨论过,但我真的找不到解决问题的方法.我想用QDomDocument读取XML文件中的数据,我得到这种类型的错误:

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)
Run Code Online (Sandbox Code Playgroud)

包括我

#include <QCoreApplication>
#include <QtXml/QtXml>
#include <QDebug>
Run Code Online (Sandbox Code Playgroud)

我还将Qt + = xml添加到.pro文件中

Zla*_*mir 9

将模块添加到.pro文件后,您需要运行qmake(这将重新生成带有正确库的makefile,然后链接器将找到这些库)