Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. MOC problem
QtWS25 Last Chance

MOC problem

Scheduled Pinned Locked Moved General and Desktop
7 Posts 6 Posters 17.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Leetmaster
    wrote on last edited by
    #1

    Hi, I'm working on a project with Visual Studio 2005 (Win XP SP3 32bit, Qt 4.6.2, Qt Add-in 1.1.5) and I need to add a new QObject class. I'm not sure the problem is directly connected to Qt, but when I try to build the class , VS2005 return me this error:

    bq. 1>moc_classTest.cpp
    1>c1xx : fatal error C1083: Cannot open source file: '.\generatedfiles\debug\moc_classTest.cpp': No such file or directory
    1>moc_classTest.cpp

    In other words it seems that VS2005 can't create the relative moc (it's not a file system's right problem). Here's class code:

    @#include <QObject>

    class classTest: public QObject
    {
    Q_OBJECT
    public:
    classTest();
    };@

    If I remove Q_OBJECT macro, the compilation will complete successfully, but I need to use signal and slot.... :(
    Does anyone have a suggestions?

    1 Reply Last reply
    0
    • K Offline
      K Offline
      kamalakshantv
      wrote on last edited by
      #2

      Seems "this":http://bugreports.qt.nokia.com/browse/QTBUG-4756 bug report will help you.

      1 Reply Last reply
      0
      • F Offline
        F Offline
        Frank
        wrote on last edited by
        #3

        Does your .cpp file include the moc file? If yes, try to remove the include.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          Frank, don't think it is the reason, because after Q_OBJECT removing all compiling ok for author.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            Did you set the MOC variable in your .pro file?

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply
            0
            • B Offline
              B Offline
              blex
              wrote on last edited by
              #6

              Was moc-file generated at all by MOC? Was MOC tool called from MSVC during the build (the corresponding message should present in compilation log)?

              Is MOC_DIR set in the *.pro file?


              Oleksiy Balabay

              1 Reply Last reply
              0
              • L Offline
                L Offline
                Leetmaster
                wrote on last edited by
                #7

                [quote author="QtK" date="1291378684"]Seems "this":http://bugreports.qt.nokia.com/browse/QTBUG-4756 bug report will help you.[/quote]

                Ok, this is exactly my problem... I've tried to follow the instruction founded in the Bug Report to resolve the problem ("Opening the include directories for editing (without actually changing anything) and resaving them in Visual Studio corrected the problem."), but I didn't understand what exactly I need to do for "open include directories" ( I'm a quite new Visual Studio user :( ).

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved