Results 1 to 7 of 7

Thread: Examples: main.moc: No such file or directory

  1. #1
    Join Date
    Sep 2010
    Posts
    36
    Thanks
    1

    Default Examples: main.moc: No such file or directory

    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?

  2. #2
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Examples: main.moc: No such file or directory

    If a moc file is missing, rerun qmake and it should work. (Maybe you also need to clean the directory)

  3. #3
    Join Date
    Nov 2010
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Examples: main.moc: No such file or directory

    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).

  4. #4
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Examples: main.moc: No such file or directory

    are you sure you need the explicit include of the moc file in main.cpp? Normally you don't need it. Try without.

  5. #5
    Join Date
    Jan 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Examples: main.moc: No such file or directory

    Quote Originally Posted by Lykurg View Post
    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'

  6. #6
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    4,380
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows Symbian S60
    Thanks
    19
    Thanked 1,005 Times in 913 Posts
    Wiki edits
    5

    Default Re: Examples: main.moc: No such file or directory

    How does your files look like?

  7. #7
    Join Date
    Feb 2011
    Posts
    1
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Examples: main.moc: No such file or directory

    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

Similar Threads

  1. Replies: 1
    Last Post: 23rd May 2011, 05:53
  2. Replies: 4
    Last Post: 9th May 2010, 17:18
  3. Replies: 2
    Last Post: 9th March 2010, 06:21
  4. Replies: 10
    Last Post: 15th June 2009, 20:44
  5. lqtmaind - no such file or directory
    By krivenok in forum Qt Programming
    Replies: 2
    Last Post: 21st February 2006, 19:05

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.