qt moc.exe error

2019-05-13 21:41发布

问题:

i'm using QT Creator 1.3.1 and trying to compile, but get this error... please help me get rid of it

mingw32-make[1]: Leaving directory `C:/Documents and Settings/eyalk/My Documents/My QT Projects/XML'
mingw32-make: Leaving directory `C:/Documents and Settings/eyalk/My Documents/My QT Projects/XML'
'C:/Qt/2010.02.1/qt/bin\moc.exe' is not recognized as an internal or external command,
operable program or batch file.
mingw32-make[1]: *** [debug/moc_mainwindow.cpp] Error 1
mingw32-make: *** [debug] Error 2
Exited with code 2.
Error while building project XML
When executing build step 'Make'

回答1:

Did you check in Tools->Options->Qt4 if the QMake Location is correct ? I guess QtCreator is looking for moc.exe in the same folder.

On many workstation, I had to manually configure the QMake (and mingw) location otherwise I would get the same error as you.



回答2:

I had a same debug problem. Just set the system path correctly. Go to "Enviroment Variables from system variables select Path and by spliting with ; add path were your qt is located :

C:\qt\4.7.4-vc\bin (). 

Hope it will help!



回答3:

This problem occurs if the Build Settings/Build Direcory is not correct as well.