I begin to study qt (I have qt creator, last version), so I read the reference how to begin to work with it and I'm trying to compile project "Animated Tiles" but I receive an error, can somebody please explain why:
Running build steps for project animatedtiles...
Configuration unchanged, skipping qmake step.
Starting: "D:/QT_prog/mingw/bin/mingw32-m开发者_开发技巧ake.exe" -w
mingw32-make: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
D:/QT_prog/mingw/bin/mingw32-make -f Makefile.Debug all
mingw32-make[1]: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make[1]: Nothing to be done for `all'.
mingw32-make[1]: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
D:/QT_prog/mingw/bin/mingw32-make -f Makefile.Release all
mingw32-make[1]: Entering directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
g++ -c -O2 -frtti -fexceptions -mthreads -Wall -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -I"..\..\..\include\QtCore" -I"..\..\..\include\QtGui" -I"..\..\..\include" -I"..\..\..\include\ActiveQt" -I"tmp\moc\release_shared" -I"..\animatedtiles" -I"." -I"..\..\..\mkspecs\win32-g++" -o tmp\obj\release_shared\main.o ..\animatedtiles\main.cpp
..\animatedtiles\main.cpp:257:20: error: main.moc: No such file or directory
mingw32-make[1]: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make: Leaving directory `D:/QT_prog/qt/examples/animation/animatedtiles-build-desktop'
mingw32-make[1]: *** [tmp/obj/release_shared/main.o] Error 1
mingw32-make: *** [release-all] Error 2
The process "D:/QT_prog/mingw/bin/mingw32-make.exe" exited with code %2.
Error while building project animatedtiles (target: Desktop)
When executing build step 'Сборка'
Looks like the main.moc file hasn't be generated.
Try this:
- Clean the Project "Build" -> "Clean All" or "Clean Project "
- Build the project again, Ctrl+B
If that doesn't work then:
- Comment out the
#include "main.moc"
line at the end of main.cpp - Perform a build, moc should run and create
main.moc
, but the build will fail. - Uncomment
#include "main.moc"
, and build again. Should work
Edit:
I'm not very familiar with qt creator, so you might also want to try just remove the #include "main.moc"
line altogether. QMake might be smart enough and figure out what to do.
The suggested solution did not work for me. I had to copy main.moc from release_shared up to the directory containing main.cpp. QT 2010.05, Win7.
I think you are experiencing this:
http://bugreports.qt.io/browse/QTCREATORBUG-1889
I was able to reproduce this issue with Qt SDK 2010.04.
- Install Qt SDK 2010.04 on Windows 7
- Open animatedtiles
- Build
Removing c:\Qt\2010.04\qt\exmaples\animation\animatedtiles\tmp\moc\release_shared\main.moc manually solved the issue.
精彩评论