Please nominate your Qt Champions for 2021!

MOC problem

  • 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

    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

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

  • Seems "this": bug report will help you.

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

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

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

  • 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?

  • [quote author="QtK" date="1291378684"]Seems "this": 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 :( ).

Log in to reply