PDA

View Full Version : Examples: main.moc: No such file or directory



rubikon
22nd September 2010, 14:53
Hello.

I'm using Qt4.6.3 and Qt Creator 2.0.0.

If I try to compile an animation example e.g. appchooser or states I'll get the message 'No such file or directory'

How can I solve this problem?

Lykurg
22nd September 2010, 15:37
If a moc file is missing, rerun qmake and it should work. (Maybe you also need to clean the directory)

weylspinor
14th November 2010, 03:10
I'm having the same problem. I selected 'Clean Project' in the Build menu, and then 'Run qmake', and I get the same problem. It's builds about 1/2 of the project and then says 'main.moc: No such file or directory'. I can see that there is: '#include "main.moc"' at the end of main.cpp. I can also find the mile in my build directory. So I know that it must just be a directory name mistake. By the way, I am running on a Windows 7 64 bit, and using Qt Creator 2.0.1, Qt 4.7.0 (32 bit).

Lykurg
14th November 2010, 08:53
are you sure you need the explicit include of the moc file in main.cpp? Normally you don't need it. Try without.

linoux
10th January 2011, 19:35
are you sure you need the explicit include of the moc file in main.cpp? Normally you don't need it. Try without.

I tried without the #include "main.moc" and i got other errors like undefined reference to 'vtable for Pixmap'

Lykurg
10th January 2011, 21:33
How does your files look like?

mikey32935
14th February 2011, 14:05
I found the "main.moc" file, kind of by accident. It was located at "C:\Qt\2010.01\qt\examples\animation\animatedtiles". I copied the file into the "animated tiles" example. Did a "Clean All", qmake, then a run. It worked fine.

-- Mike