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.
-
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);\ app.setOrganizationName("QtProject");\ app.setOrganizationDomain("qt-project.org");\ app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\ QQuickView view;\ if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\ QSurfaceFormat f = view.format();\ f.setProfile(QSurfaceFormat::CoreProfile);\ f.setVersion(4, 4);\ view.setFormat(f);\ }\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ new QQmlFileSelector(view.engine(), &view);\ view.setSource(QUrl("qrc:///" #NAME ".qml")); \ view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ view.showFullScreen();\ } else {\ view.show();\ }\ return app.exec();\ }
-
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);\ app.setOrganizationName("QtProject");\ app.setOrganizationDomain("qt-project.org");\ app.setApplicationName(QFileInfo(app.applicationFilePath()).baseName());\ QQuickView view;\ if (qgetenv("QT_QUICK_CORE_PROFILE").toInt()) {\ QSurfaceFormat f = view.format();\ f.setProfile(QSurfaceFormat::CoreProfile);\ f.setVersion(4, 4);\ view.setFormat(f);\ }\ view.connect(view.engine(), SIGNAL(quit()), &app, SLOT(quit()));\ new QQmlFileSelector(view.engine(), &view);\ view.setSource(QUrl("qrc:///" #NAME ".qml")); \ view.setResizeMode(QQuickView::SizeRootObjectToView);\ if (QGuiApplication::platformName() == QLatin1String("qnx") || \ QGuiApplication::platformName() == QLatin1String("eglfs")) {\ view.showFullScreen();\ } else {\ view.show();\ }\ return app.exec();\ }
@embdev said in QGuiApplication: No such file or directory:
QQmlEngine
Well, if you check the Qt documentation for QQmlEngine you will find out what you need to do :
QT += qml
http://doc.qt.io/qt-5/qqmlengine.html -
@embdev said in QGuiApplication: No such file or directory:
QQmlEngine
Well, if you check the Qt documentation for QQmlEngine you will find out what you need to do :
QT += qml
http://doc.qt.io/qt-5/qqmlengine.html