如何在Windows下使用qmake链接一个针对xmlpatterns的Qt应用程序
How to link a Qt application against xmlpatterns with qmake under Windows
我有以下.pro文件:
TEMPLATE = app
QT += qml quick xmlpatterns
CONFIG += c++11
SOURCES += main.cpp
RESOURCES += qml.qrc
此外,我在我的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();
}
尽管我的Qt安装中的xmlpatterns示例进行了编译,但这段代码并不编译。我在这里错过了什么???
Qt Creator找不到标题QtXmlPatterns(它存在,我检查过了),如果我替换
#include <QtXmlPatterns>
带有
#include <QtXmlPatterns/QtXmlPatterns>
Qt创建者找到了标头,但无法链接到QtXmlPatterns lib:
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
debugBrainReliefer.exe : fatal error LNK1120: 2 unresolved externals
如何编译此应用程序?
我终于升级到了Qt 5.6,它开始工作了。
相关文章:
- 如何创建一个CMake变量,除非显式重写,否则使用默认值
- 删除一个线程上有数百万个字符串的大型哈希映射会影响另一个线程的性能
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- 运行同一解决方案的另一个项目的项目
- 挂起和取消挂起一个文件DLL
- 用C++中的一个变量定义一个常量
- 函数向量_指针有不同的原型,我可以构建一个吗
- 在c++中用vector填充一个简单的动态数组
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 预处理器:插入结构名称中的前一个行号
- 我在c++代码中生成了一个运行时#3异常
- 我想将一个对T类型的非常量左值引用绑定到一个T类型的临时值
- 从链接列表c++中删除一个项目
- 告诉一个 const char 数组,除了编译时 C 样式的字符串外,它不以 '