[SOLVED] Project compiles in Qt Creator, but not in qmake

• I've made a simple program to mute other applications using Qt and the Windows API. When I open the .pro file in Qt Creator and compile, it works fine. However, when I run:

``````qmake
mingw32-make
``````

in cmd, it can't find mmdeviceapi.h (part of the Windows API).

Full log:

``````mingw32-make -f Makefile.Release
mingw32-make[1]: Entering directory `C:/Program Files (x86)/Jenkins/workspace/Mute Exceptions'
g++ -c -pipe -fno-keep-inline-dllexport -O2 -std=c++0x -frtti -Wall -Wextra -fexceptions -mthreads -DUNICODE -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_NEEDS_QMAIN -I"." -I"..\..\..\..\Qt\5.4\mingw491_32\include" -I"..\..\..\..\Qt\5.4\mingw491_32\include\QtWidgets" -I"..\..\..\..\Qt\5.4\mingw491_32\include\QtGui" -I"..\..\..\..\Qt\5.4\mingw491_32\include\QtCore" -I"release" -I"." -I"..\..\..\..\Qt\5.4\mingw491_32\mkspecs\win32-g++"  -o release\main.o src\main.cpp
In file included from src\main.cpp:1:0:
src\MainWindow.h:9:25: fatal error: mmdeviceapi.h: No such file or directory
compilation terminated.
mingw32-make[1]: *** [release/main.o] Error 1
mingw32-make[1]: Leaving directory `C:/Program Files (x86)/Jenkins/workspace/Mute Exceptions'
mingw32-make: *** [release] Error 2
``````

I'm on Windows 7, using Qt 5.4 and the MinGW 4.9.1 packages that come with Qt. (Qt 5.4/MinGW 4.9.1 (32bit) OpenGL and Tools/MinGW 4.9.1).

Not sure what I'm doing wrong since it works in Qt Creator.

• Hi,

can you check if in Qt Creator Build Environment there's some special settings?
And also how qmake is invoked by Qt Creator?

• Thanks. You set me on the right track.

The problem was that I wasn't actually using the Qt MinGW package. I just thought I was. I was using a four year old version of MinGW I had installed in C:\MinGW since that was earlier in the PATH. Qt Creator seems to automatically add its MinGW to the beginning of the PATH so it was using the correct version of MinGW while I was using the old one.

So a pretty clear sign that cleaning up my PATH is well overdue. (Also in there, 4 year old GTK.)

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.