Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

error: 'QQmlApplicationEngine' file not found



  • Hi all,
    My Qt version is 4.7.84 and Im getting this error:

    error: 'QQmlApplicationEngine' file not found
    and my pro file is here:
    I added these lines to fix the problem there werent these codes at first

    QT += widgets
    QT += qml
    QT += gui
    QT += multimedia
    
    QT += quick qml multimedia widgets
    QT += widgets
    QT += qml
    QT += gui
    QT += multimedia
    CONFIG += c++11
    
    # The following define makes your compiler emit warnings if you use
    # any feature of Qt which as been marked deprecated (the exact warnings
    # depend on your compiler). Please consult the documentation of the
    # deprecated API in order to know how to port your code away from it.
    DEFINES += QT_DEPRECATED_WARNINGS
    # You can also make your code fail to compile if you use deprecated APIs.
    # In order to do so, uncomment the following line.
    # You can also select to disable deprecated APIs only up to a certain version of Qt.
    #DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0
    
    SOURCES += \
            main.cpp \
        controller.cpp \
        pyloncamera.cpp \
        testobject.cpp \
        cameracalibrator.cpp \
        logging.cpp \
        imagecontrol.cpp
    INCLUDEPATH += /usr/local/include/opencv
    INCLUDEPATH += /opt/pylon5/include
    #LIBS += -L/usr/local/lib/ -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs
    LIBS += -L/opt/pylon5/lib64 -Wl,-E -lpylonutility -lGenApi_gcc_v3_1_Basler_pylon_v5_1 -lGCBase_gcc_v3_1_Basler_pylon_v5_1
    LIBS += `pkg-config --cflags --libs opencv`
    LIBS += -L/opt/pylon5/lib64/ \
    -lbxapi \
    -lNodeMapData_gcc_v3_1_Basler_pylon_v5_1 \
    -lLog_gcc_v3_1_Basler_pylon_v5_1 \
    -lXmlParser_gcc_v3_1_Basler_pylon_v5_1 \
    -lpylonutility \
    -lpylonutility-5.1.0 \
    -lGenApi_gcc_v3_1_Basler_pylon_v5_1 \
    -lGCBase_gcc_v3_1_Basler_pylon_v5_1 \
    -lpylonbase-5.1.0 \
    -lMathParser_gcc_v3_1_Basler_pylon_v5_1
    RESOURCES += qml.qrc
    
    HEADERS += \
        controller.h \
        pyloncamera.h \
        testobject.h \
        calibframe.h \
        cameracalibrator.h \
        logging.h \
        imagecontrol.h
    
    FORMS +=
    
    DISTFILES +=
    

  • Moderators

    @Yunus
    the answer is simple, really:

    QQmlApplicationEngine is a Qt 5 feature only, 5.1 to be exact

    0_1559112362216_8b5a8570-b8d2-433f-9cdd-d52eb902f646-image.png



  • @J-Hilk

    thank for ur reply. Is there a way to use this header with my qt version? or should I uninstall 4.8 and install 5.1 again?


  • Moderators

    @Yunus
    if you have the option to upgrade to qt5 that I would suggest going with the newest 5.12.3 or the latest LTS version (iirc 5.9)

    otherwise you'll have to check get the source code of QQmlApplicatioEngine and compile it with your qt4 setup.

    But the difference between 4 and 5 is huge and my not be possible or a huge end over



  • @J-Hilk Ok. But one more question I have an another computer which has the same qt version and the same code is running on it. its version can be checked below. I guess its version is not 5.1 but why running on it?

    0_1559116549247_cropped.jpg


  • Lifetime Qt Champion

    @Yunus It shows you which Qt version was used to build QtCreator not the one used to build projects. To find out which Qt version is used check the Kit configuration used.


  • Moderators

    @Yunus
    nono, QtCreator != Qt

    QtCreator is your IDE, the qt version you build and link against is defined in your kit, that you use!



  • @J-Hilk @jsulm Thank you... Sorry for my ignorance



  • @Yunus This is a really common mistake by new users/developer, when "we" speaking about Qt Version, the meaning is "Qt Kits Version".
    You can find them in Qt Creator menu "Tools/Options/Kits", there are the different Qt Versions available for build a project: a Qt Kit is defined by Qt source version (5.x.x), target plateform (Linux x86/ARM, Android, IOs, Windows flawors, etc) and compiler type/version (GCC, CLANG, MSVC, etc).

    QtCreator is an IDE that helps source code editing and debuging, Qt Kit, is the Qt Libs your used to build your application.

    hope this is more clear for you now.


Log in to reply