Please nominate your Qt Champions for 2021!

Raspberry Pi 4B qtcreator error QGuiApplication not found

  • I have raspberry Pi 4 B with 2021-05-07-raspios-buster-armhf-full , os installed in SD card
    Further i have installed Qt with following commands after
    sudo apt-get install qt5-default
    sudo apt-get install qtcreator

    i launch qtcreator from terminal and select Qt Quick application empty
    Then in main.cpp i find
    QGuiApplication not found
    QQmlApplicationEngine not found

  • Lifetime Qt Champion

    @MathewV Did you include QGuiApplication and QQmlApplicationEngine header files?
    You also need "QT += gui" in your pro file.
    For QQmlApplicationEngine you also need QT += qml in pro file.

  • @jsulm
    Yes sir
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>

  • Yes sir, since I have selected Qt Quick application empty and clicked on "next " as the buttons followed

    the header where included by default in main.cpp
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>

    and i inserted
    QT += qui
    QT += qml
    in pro file

    When i launch qtcreator from terminalopen qmain.cpp file, I get the warning
    This file is not part of any projects,
    and there are red circle markers along the left border of the code right from
    #include <QGuiApplication>
    #include <QQmlApplicationEngine>

  • Lifetime Qt Champion

    @MathewV said in Raspberry Pi 4B qtcreator error QGuiApplication not found:

    This file is not part of any projects

    You have to open the PROJECT file, not cpp. It's the file extension.

  • @jsulm
    Sir My problem is solved
    As mentioned by you, in I inserted
    QT += gui
    QT += qml

    but still i was getting error of Unknown module(s) in QT: quick qml
    then in terminal i executed
    sudo apt-get install qtdeclarative5-dev
    rebooted the RPi
    From terminal window executed qtcreator
    Opened my recent project and by Gods grace no error
    Thank you @jsulm for your support, God Bless You

Log in to reply