Search code examples
c++qtvisual-studio-2013compiler-errorsmoc

MOC file generation in VS2013


I have a project generated from a .pro file. I cannot compile it because MOC files are not generated.

  • Q_OBJECT is used in headers for classes to be MOCed
  • #pragma once is used in headers for classes to be MOCed

I put the verbosity to detailled, and I can see that moc is called on the right classes. Then, there is following error: standard input(0): Note: No relevant classes found. No output generated.

Finally, compiler cannot link moc files, and build is failing:

8>  moc_myClass.cpp
8>c1xx : fatal error C1083: Cannot open source file: 
'D:\Things\\L_build\Stuff\moc\moc_myClass.cpp': No such file or directory

Any clue?


Solution

  • I solve the problem by these two steps: 1. delete Q_OBJECT and rebuild 2. add Q_OBJECT and rebuild again