简体   繁体   English

如何在Windows下使用qmake链接xmlpatterns的Qt应用程序

[英]How to link a Qt application against xmlpatterns with qmake under Windows

I have the following .pro file: 我有以下.pro文件:

TEMPLATE = app
QT += qml quick xmlpatterns
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc

Moreover, I have the following main.cpp in my Qt project (in Qt Creator, using Qt 5.5): 此外,我的Qt项目中有以下main.cpp(在Qt Creator中,使用Qt 5.5):

#include <QGuiApplication>
#include <QQmlApplicationEngine>
#include <QtXmlPatterns>

int main(int argc, char *argv[])
{
  QXmlSchema schema;

  QGuiApplication app(argc, argv);

  QQmlApplicationEngine engine;
  engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

  return app.exec();
}

This code doesn't compile, even though the xmlpatterns example in my Qt installation does compile. 即使我的Qt安装中的xmlpatterns示例可以编译,该代码也不会编译。 What am I missing here??? 我在这里想念什么???

Qt Creator doesn't find the header QtXmlPatterns (which exists, I checked that) and if I replace Qt Creator找不到标题QtXmlPatterns(已存在,我检查过),如果替换

#include <QtXmlPatterns>

with

#include <QtXmlPatterns/QtXmlPatterns>

Qt Creator finds the header but can't link against the QtXmlPatterns lib: Qt Creator找到了标头,但无法链接到QtXmlPatterns库:

main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QXmlSchema::QXmlSchema(void)" (__imp_??0QXmlSchema@@QAE@XZ) referenced in function _main
main.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall QXmlSchema::~QXmlSchema(void)" (__imp_??1QXmlSchema@@QAE@XZ) referenced in function _main
debug\BrainReliefer.exe : fatal error LNK1120: 2 unresolved externals

How can I get this application compiled? 我该如何编译该应用程序?

我终于升级到Qt 5.6,它可以工作了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM