Qt moc not working when run from some locations
Pergunta
I have a Qt project that I'm trying to compile with jom on Windows 7. I can compile it fine from the command line when the source is in one location. However, when I pull the source from git in another location and try and compile it, I get the following error
moc: Too many input files specified
This is really weird as in both cases I'm just pulling from the same git repository and the code compiles fine in one location and fails in another. I've tried nmake and got the same results.
As a comparison, here are the two commands. The first one fails, the second one succeeds.
C:\QtSDK\Desktop\Qt\4.7.4\msvc2008\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DSRCDIR=\"C:/Users/Jon Morra/.hudson/jobs/Organizer/workspace/MVSComplete/SshTests/\" -DQT_DLL -DQT_NO_DEBUG -DQT_TESTLIB_LIB -DQT_NETWORK_LIB -DQT_CORE_LIB -DQT_HAVE_MMX -DQT_HAVE_3DNOW -DQT_HAVE_SSE -DQT_HAVE_MMXEXT -DQT_HAVE_SSE2 -DQT_THREAD_SUPPORT -I"c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtCore" -I"c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtNetwork" -I"c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtTest" -I"c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\include" -I"..\..\MVSComplete\QtSftpWrapper" -I"c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\ActiveQt" -I"release" -I"..\..\MVSComplete\SshTests" -I"." -I"c:\QtSDK\Desktop\Qt\4.7.4\msvc2008\mkspecs\win32-msvc2008" -D_MSC_VER=1500 -DWIN32 ..\..\MVSComplete\SshTests\tst_sshteststest.cpp -o release\tst_sshteststest.moc
C:\QtSDK\Desktop\Qt\4.7.4\msvc2008\bin\moc.exe -DUNICODE -DWIN32 -DQT_LARGEFILE_SUPPORT -DSRCDIR=\"C:/MVS/MVSOrganizerQt/MVSComplete/SshTests/\" -DQT_DLL -DQT_NO_DEBUG -DQT_TESTLIB_LIB -DQT_NETWORK_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.7.4\msvc2008\include\QtCore" -I"..\..\..\..\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtNetwork" -I"..\..\..\..\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\QtTest" -I"..\..\..\..\QtSDK\Desktop\Qt\4.7.4\msvc2008\include" -I"..\..\MVSComplete\QtSftpWrapper" -I"..\..\..\..\QtSDK\Desktop\Qt\4.7.4\msvc2008\include\ActiveQt" -I"release" -I"..\..\MVSComplete\SshTests" -I"." -I"..\..\..\..\QtSDK\Desktop\Qt\4.7.4\msvc2008\mkspecs\win32-msvc2008" -D_MSC_VER=1500 -DWIN32 ..\..\MVSComplete\SshTests\tst_sshteststest.cpp -o release\tst_sshteststest.moc
Any ideas what is going on?
Solução
I suspect it's because your first path contains a space: "C:/Users/Jon Morra/..." QMake doesn't handle spaces in paths very well, i.e. it doesn't escape them correctly at all times, and so a path with a space gets interpreted as two arguments instead of one at some point. I recommend to always use paths without spaces for your source dir when building with quake. E.g. put your sources into
c:\work\someproject
instead of
C:\Users\John Doe\work\someproject