在debug模式下编译提示c1xx : fatal error C1083: 无法打开源文件: “generatedfiles\release\moc_XXX.cpp
打开项目的vcxproj文件<ClCompile Include="generatedfiles\Debug\moc_SFQTPictureEx.cpp"><ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedF...
打开项目的vcxproj文件
<ClCompile Include="generatedfiles\Debug\moc_XXXX">
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
</ClCompile>
ClCompile 项中的ExcludedFromBuild
需要编译的为false,不需要编译的为true
比如上面
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</ExcludedFromBuild>
Release不编译,Debug编译
LNK2001 无法解析的外部符号 "public: virtual int __thiscall XXXXXXXX::qt_metacall(enum QMetaObject::Call,int,void * *)
同样的这个情况也可能是moc文件没编进去检查一下是否被排除了
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VC\VCTargets\Microsoft.CppBuild.targets(937,5): warning MSB8027: 名为 moc_Timer.cpp 的两个或更多文件将生成到同一位置的输出。这会导致错误的生成结果。 调用的文件是 generatedfiles\Debug\moc_XXXXXX.cpp, generatedfiles\Release\moc_XXXXX.cpp。
这个警告是因为
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
2个都为true
魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。
更多推荐



所有评论(0)