Important: Please read the Qt Code of Conduct -

error: 'QMainWindow' file not found #include <QMainWindow> ^

  • Hi,

    I'm using Qt.5.70 version and macOS 10.12.

    I have an exist project that is created as C++ project. Then i find out that I need GUI, so I add New Qt Designer Form Class to create a GUI.

    But when I try to build, there is an error:

    /Users/zhijunchen/Dropbox/Wholesale-Clud/src/Wholesale-Club/mainwindow.h:8: error: 'QMainWindow' file not found
    #include <QMainWindow>

    I have these in my .pro file already:

    QT += core gui

    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

    but still not working.

    Can anyone help me please?
    Thank you!

  • Hi,
    maybe you just need to re-run qmake.

  • Hi @AnnieChen

    I think that you need to add also widgets module in your .pro file

    QT += widgets

    If this not work for you , can tell us which qt version are you using?

Log in to reply