简体   繁体   English

VS2013中的MOC文件生成

[英]MOC file generation in VS2013

I have a project generated from a .pro file. 我有一个从.pro文件生成的项目。 I cannot compile it because MOC files are not generated. 我无法编译它,因为未生成MOC文件。

  • Q_OBJECT is used in headers for classes to be MOCed Q_OBJECT用于要MOCed的类的标头中
  • #pragma once is used in headers for classes to be MOCed #pragma once在标头中用于要MOCed的类

I put the verbosity to detailled, and I can see that moc is called on the right classes. 我详细介绍了详细情况,可以看到在正确的类上调用了moc。 Then, there is following error: standard input(0): Note: No relevant classes found. No output generated. 然后,出现以下错误: standard input(0): Note: No relevant classes found. No output generated. standard input(0): Note: No relevant classes found. No output generated.

Finally, compiler cannot link moc files, and build is failing: 最后,编译器无法链接moc文件,并且构建失败:

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? 有什么线索吗?

我通过以下两个步骤解决了这个问题:1.删除Q_OBJECT并重建2.添加Q_OBJECT并再次重建

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM