1

I'm getting a linker error that a whole host of symbols including QQmlEngine and QQmlComponent constructors are undefined, from the main.cpp:

#include <QCoreApplication>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlComponent>
#include <QtQml/QQmlContext>

int main(int argc, char* argv[]){
    QCoreApplication app(argc, argv);
    QQmlEngine eng;

    QQmlComponent component(&eng, QUrl::fromLocalFile("app.qml"));
    component.create();
}

I've run qmake -project, and rebuilt all.

Browsing other questions, and the docs, it seems the include should be QQmlEngine, but this is not found, and QtQml/QQmlEngine is. Are they one in the same, or is that the problem?

OJFord
  • 10,522
  • 8
  • 64
  • 98

1 Answers1

3

Add the following to your .pro file:

QT += qml quick
Oleg Shparber
  • 2,732
  • 1
  • 18
  • 19
  • Ah that got it, thanks! Seems like 5 settings for every change sometimes! Now I'm getting 'component not ready' though, not sure if related? – OJFord Oct 23 '14 at 15:11