[Solved] Error: forward declaration of 'class QQmlContext'
I'm playing with QML/C++ integration and now I'm trying to set context property as described here http://qt-project.org/doc/qt-5.0/qtqml/qtqml-cppintegration-contextproperties.html
So my code looks like this
int main(int argc, char *argv)
QGuiApplication app(argc, argv);
QtQuick2ApplicationViewer viewer; viewer.rootContext()->setContextProperty(QStringLiteral("somedata"), QDateTime::currentDateTime()); viewer.setMainQmlFile(QStringLiteral("qml/TestQML/main.qml")); viewer.showExpanded(); return app.exec();
I've just added line 10 to the project generated code
But unfortunately I've got this error
../TestQML/main.cpp:10:25: error: invalid use of incomplete type 'class QQmlContext'
In file included from ../Qt5.1.0/5.1.0/gcc/include/QtQuick/QQuickView:1:0,
../Qt5.1.0/5.1.0/gcc/include/QtQuick/qquickview.h:52:7: error: forward declaration of 'class QQmlContext'
Maybe someone came across with that before?
You seem to be missing:
SGaist, thank you very very much. Last 10 years I spent with java and now I'm having a lot of fun with such stupid mistakes. Thank you for you time and have a nice day
You're welcome ! A little learning curve... Happy coding :)