I'm trying to build the qtestlib/tutorial1 example, but the testqstring.moc file isn't being generated when I run nmake
(I'm running Qt 4.5.2 on Windows XP SP3).
I copied testqstring.cpp from the tutorial directory to my build directory (C:\sandboxes\testqstring) and from the Qt command prompt ran vsvars32.bat file from my MS Visual Studio 8 installation to add the VS environment variables.
According to the tutorial, I should run:
> qmake -project "CONFIG += qtestlib"
> qmake
> nmake
When I do, the output from nmake
is:
C:/Apps/Qt/2009.03/qt/bin\moc.exe -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"....\Apps\Qt\2009.03\qt\include\QtCore" -I"....\Apps\Qt\2009.03\qt\include\QtGui" -I"....\Apps\Qt\2009.03\qt\include\QtTest" -I"....\Apps\Qt\2009.03\qt\include" -I"." -I"....\Apps\Qt\2009.03\qt\include\ActiveQt" -I"debug" -I"....\Apps\Qt\2009.03\qt\mkspecs\win32-g++" -D__GNUC__ -DWIN32 testqstring.cpp -o debug\testqstring.moc
g++ -c -g -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_TESTLIB_LIB -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -I"....\Apps\Qt\2009.03\qt\include\QtCore" -I"....\Apps\Qt\2009.03\qt\include\QtGui" -I"....\Apps\Qt\2009.03\qt\include\QtTest" -I"....\Apps\Qt\2009.03\qt\include" -I"." -I"....\Apps\Qt\2009.03\qt\include\ActiveQt" -I"debug" -I"....\Apps\Qt\2009.03\qt\mkspecs\win32-g++" -o debug\testqstring.o testqstring.cpp
testqstring.cpp:63:27: testqstring.moc: No such file or directory
NMAKE : fatal error U1077: 'C:\Apps\Qt\2009.03\mingw\bin\g++.EXE' : return code '0x1' Stop.
NMAKE : fatal error U1077: 'C:\PROGRA~1\MICROS~3\VC\BIN\nmake.exe' : return code '0x2' Stop.
So, I can see that moc.exe is being called to generate debug/testqstring.moc, but that file is never generated.
Thank you for any and all guidance you can provide.
It looks like you're trying to use nmake
to do a build with MinGW. nmake
is an MSVC tool.
If you want to do a build with MinGW you must use mingw32-make
. If you want to do a build with MSVC you must use a Qt built with MSVC (which means you have to build it yourself or have a commercial license).