Important: Please read the Qt Code of Conduct -

'qmake' examples fail for freshly installed Qt-5.7

  • Hello experts.

    I installed a fresh Qt-5.7 version and I am trying to setup a basic hello world project using qmake following the Qt qmake tutorial. After I manually create the project file

    HEADERS += hello.h
    SOURCES += hello.cpp
    SOURCES += main.cpp

    and run 'qmake -o Makefile' I get the follow output:
    > qmake -o Makefile
    The system cannot find the path specified.
    The system cannot find the path specified.
    The system cannot find the path specified.

    However all necessary files are created (Makefile, Makefile.Debug, Makefile.Release as well as empty debug and release folders). Running make returns

    > make
    mingw32-make -f Makefile.Release
    mingw32-make[1]: Entering directory 'C:/Qt/Qt5.7.0/Examples/Qt-5.7/qmake/tutorial'
    g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=gnu++11 -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I. -I../../../../5.7/mingw53_32/include -I../../../../5.7/mingw53_32/include/QtGui -I../../../../5.7/mingw53_32/include/QtANGLE -I../../../../5.7/mingw53_32/include/QtCore -Irelease -I../../../../5.7/mingw53_32/mkspecs/win32-g++ -o release/hello.o hello.cpp
    In file included from hello.cpp:52:0:
    hello.h:51:23: fatal error: QPushButton: No such file or directory
    compilation terminated.
    Makefile.Release:172: recipe for target 'release/hello.o' failed
    mingw32-make[1]: *** [release/hello.o] Error 1
    mingw32-make[1]: Leaving directory 'C:/Qt/Qt5.7.0/Examples/Qt-5.7/qmake/tutorial'
    Makefile:34: recipe for target 'release' failed
    mingw32-make: *** [release] Error 2

    My own attempts of creating a fresh project have all failed, so help of any kind is greatly appreciated.


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    You are missing QT += widgets in your .pro file.

    The widgets have got their own modules in Qt 5.

  • Hi, thanks for the hint. I still get the missing path errors, however make now does compile successfully but the program crashes instantly (see screenshot). Some procedure entry point could not be located.. ? This seems like an odd error for a new Qt installation, maybe I should consider reinstalling it?

    Or might I have done something wrong somewhere else? I installed Qt-5.7 for mingw 5.3 (which came with Qt inside the tools directory) and then added the mingw /bin and the Qt /bin paths to my PATH variable. Now I am using vim, make and qmake via a terminal. Is that okay so far?

  • Lifetime Qt Champion

    It's not odd. You're doing development from command line on Windows. Since you're learning Qt, use Qt Creator, That will save you lots of time and troubles. Windows is not the most command line friendly OS for development.

    If you still want to use the command line for development, then you must add Qt's bin path to the PATH environment variable. Not from the tools folder but from the matching Qt/5.X/mingw_32. DON'T do that system wide, just for the console you're working in.

  • In fact, I started learning Qt a while ago (Qt4). I just switched to a new machine and thus needed to install Qt and I so chose to get the latest version. If it is at all possible I would like to keep using the command line since I have never had issues with qmake at all (hence my debugging skills are practically zero).

    My PATH variable contains the paths for the Qt binaries and the mingw binaries, respectively.

    And I reinstalled the whole thing, without effect. Is there anything obvious left to try?

  • Lifetime Qt Champion

    IIRC, you might have a shortcut in the start menu to open a pre-configured command line for Qt. That might be faster to get you running.

Log in to reply