QGuiApplication: No such file or directory

  • Dear fellow coders, i'm trying to use my own kit to build an exe file using the example 'clocks' in Qt examples but was unsuccessful.

    Under [Issues] window says: 'QGuiApplication: no such file or directory'

    Is there anything wrong with my Kit's qmake.exe file? When I use the default GCC desktop kit, the program compiles and run successfully.

  • Which version of Qt ?!

    Check your .pro file you need to add QT += widgets in the .pro file after that run qmake once and use #include <QApplication> instead of #include <QtGui/QApplication>

  • let me check my Qt installation again.

  • Qt Champions 2018

    @embdev Why not do what @Kambiz suggested first?

  • ah I missed that line, my network previously having some issues. let me try out @Kambiz suggestion first

  • Hi @Kambiz mbiz & @jsulm , aft added QT += widgets and using <QApplication>, the next error is "QQmlengine: No such file or directory" The following is a sample code from Clocks example, built on Qt Quick.

    #include <QDir>
    //#include <QGuiApplication>
    #include <QApplication>
    #include <QQmlEngine>
    #include <QQmlFileSelector>
    #include <QQuickView> //Not using QQmlApplicationEngine because many examples don't have a Window{}
    #define DECLARATIVE_EXAMPLE_MAIN(NAME) int main(int argc, char* argv[]) \
        QGuiApplication app(argc,argv);\
        QQuickView view;\
        if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\
            QSurfaceFormat f = view.format();\
            f.setVersion(4, 4);\
        view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\
        new QQmlFileSelector(view.engine(), &view);\
        view.setSource(QUrl("qrc:///" #NAME ".qml")); \
        if (QGuiApplication::platformName() == QLatin1String("qnx") || \
              QGuiApplication::platformName() == QLatin1String("eglfs")) {\
        } else {\
        return app.exec();\

  • Qt Champions 2018

    @embdev said in QGuiApplication: No such file or directory:


    Well, if you check the Qt documentation for QQmlEngine you will find out what you need to do :
    QT += qml

  • @jsulm okies i'll give it a shot. Thank you!

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.