I am trying to add a C ++ type to a QML system.
#include <QtGui/QGuiApplication> #include <QDeclarativeEngine> #include <QDeclarativeComponent> #include "qtquick2applicationviewer.h" #include <QQmlApplicationEngine> class FooBar: public QObject { Q_OBJECT }; int main(int argc, char *argv[]) { QGuiApplication app(argc, argv); QQmlApplicationEngine engine("qml/RBot/main.qml"); qmlRegisterType<FooBar>("io.secorp", 1, 0, "FooBar"); return app.exec(); }
But when I try to compile this (I do not import it into a .qml file, just testing), I get debugging errors.

What's wrong?
Thanks.
source share