QT moc The system cannot find the path specified error MSB8066:

文章指出,当遇到在VisualStudio中使用Qt时出现的moc编译错误,如系统找不到指定路径,可能是因为没有正确设置QTDIR。解决方案是在项目的*.vcxproj.user文件中添加QTDIR的定义,确保编译器能找到Qt的路径,同时更新PATH环境变量。


1>    Moc'ing data_interface.h...
1>    The system cannot find the path specified.
1>    Moc'ing AppLogAdapter.h...
1>    The system cannot find the path specified.
1>    Moc'ing CtpMarketDataSpi.h...
1>    The system cannot find the path specified.
1>    Moc'ing ctpfuturedataimpl.h...
1>    The system cannot find the path specified.
1>    d:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: Custom build for '..\shared\interface\data_interface.h;..\shared\AppLogAdapter.h;CtpMarketDataSpi.h;ctpfuturedataimpl.h' exited with code 3.
1>    The command exited with code 3.
1>  Done executing task "CustomBuild" -- FAILED.

   主要原因是QT VS tool没有为你设置 QTDIR,这个可以在 vs项目中include目录是否把QTDIR展开准确看出来。如果不准确,只要想vs项目 的  *.vcxproj.user 中加入QTDIR定义即可。

 

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
    <QTDIR>D:\Qt\5.15.2\msvc2019_64</QTDIR>
    <LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
    <QTDIR>D:\Qt\5.15.2\msvc2019_64</QTDIR>
    <LocalDebuggerEnvironment>PATH=$(QTDIR)\bin%3b$(PATH)</LocalDebuggerEnvironment>
  </PropertyGroup>

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值