#include <QtWidgets/QApplication>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlComponent>
#include <unistd.h>
#include <string>
#include <iostream>

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    auto *engine = new QQmlEngine(&app);

    auto cwd = getcwd(nullptr, 0);
    QString qml_path = QString(cwd) + "/test.qml";
    free(cwd);
    std::cout << qml_path.toUtf8().data() << std::endl;

    auto *comp = new QQmlComponent(engine, qml_path, QQmlComponent::CompilationMode::PreferSynchronous, engine);
    for(auto && e : comp->errors()) {
        std::cout << e.description().toUtf8().data() << std::endl;
    }
    QObject *instance = comp->create();
    return app.exec();
}