Important: Please read the Qt Code of Conduct -

[Solved] Issues with qmake and mingw

  • I have recently installed QT5.2.1 including the mingw package. I have created the standard hello.cpp and used qmake to generate the build files (qmake -project and qmake
    When I come to build (with mingw32-make) it fails by not being able to find the header file QApplication. On looking at the makefile and the various directories searched, it is not looking at the QWidget directory and hence cannot find QApplication. When I fix this (by editing the makefile) it cannot find the correct lib. Again I can fix this by including the Qt5Widget lib in the makefile.
    I am assuming I am doing something wrong, what can I do to force the compiler to look at QWidget. Is there any way I can customise a setting of Qmake so that it will add the required lines to the makefile.

    Thanks for your help

  • Your pro file likely does not contain
    QT += widgets

  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You are missing

    @QT += widgets@

    in your pro file.

    On Windows, you should use Qt Creator. Windows command line development is not as friendly as on either Linux or OS X

  • Thanks for your help.
    I initially was using the command line to try and understand what was happening better. I now understand this better and have also successfully got the same programme working under Qt Creator.

    Again thanks for your help.

  • Lifetime Qt Champion

    You're welcome !

    Since you are now a happy coder, please update the thread title prepending [solved] so other forum users may know a solution has been found :)

Log in to reply