I have a build environment set up for a bunch of C++ projects on Visual Studio 2008 that use Qt. I haven't had to recompile the code for a while, but something must have changed on my system because it doesn't work anymore.
All the environment variables are still correct, as far as I can tell, and I haven't updated Visual Studio or Qt.
The error I get is:
1>MOC mainwindow.h
1>The system cannot find the path specified.
1>moc: mainwindow.h: No such file
1>Project : error PRJ0019: A tool returned an error code from "MOC mainwindow.h"
and the offending line according to my build log is:
C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtCore" -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtGui" -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include" -I"..\..\LSL\liblsl\bin" -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\ActiveQt" -I"debug" -I"." -I..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\default -D_MSC_VER=1500 -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp
(sorry so long). It shows that moc.exe is getting called, but it can't find mainwindow.h (which is in the directory of the project, and is definitely an included directory).
I re-ran qmake qmake -project
(thanks J-Mik!), but now it is hanging on uic
1>UIC mainwindow.ui
1>The system cannot find the path specified.
1>File 'mainwindow.ui' is not valid
1>Project : error PRJ0019: A tool returned an error code from "UIC mainwindow.ui"
The file is certainly valid (it opens in Qt creator). What is also odd is that the build log is still shooting an error about moc:
C:\QtSDK\Desktop\Qt\4.8.1\msvc2008\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_GUI_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtCore" -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\QtGui" -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include" -I"..\..\LSL\liblsl\bin" -I"..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\include\ActiveQt" -I"debug" -I"." -I..\..\..\..\QtSDK\Desktop\Qt\4.8.1\msvc2008\mkspecs\default -D_MSC_VER=1500 -DWIN32 mainwindow.h -o debug\moc_mainwindow.cpp
if errorlevel 1 goto VCReportError
goto VCEnd
:VCReportError
echo Project : error PRJ0019: A tool returned an error code from "MOC mainwindow.h"
exit 1
:VCEnd