每次创建QT项目都需要去添加include目录,很麻烦,解决方法如下:
1.找到VS安装目录下的Microsoft.Cpp.MSVC.Toolset.Common.props文件
…\Microsoft Visual Studio Enterprise\2022\MSBuild\Microsoft\VC\v170\Microsoft.Cpp.MSVC.Toolset.Common.props
2.搜索$(IncludePath)定位到文件内容
<IncludePath Condition="'$(IncludePath)' == ''">
$(VC_IncludePath);$(WindowsSDK_IncludePath);
</IncludePath>
3.修改IncludePath,添加自己的include进去
<IncludePath Condition="'$(IncludePath)' == ''">
$(VC_IncludePath);
$(WindowsSDK_IncludePath);
....\Qt5_12_8\5.12.8\msvc2017_64\include;
</IncludePath>
注:这里为了显示美观,加上了换行,在修改时,原本是啥就直接加上去就好,不然可能会报fatal error RC1015: cannot open include file ‘winres.h‘这种莫名其妙的错误
解决每次创建QT项目时手动添加include目录的繁琐步骤,通过修改VS安装目录下的Microsoft.Cpp.MSVC.Toolset.Common.props文件,将Qt5的include路径添加到IncludePath中,具体操作包括找到该文件,定位到$(IncludePath),然后添加你的Qt5 include路径,例如...Qt5_12_85.12.8msvc2017_64include。注意保持原始格式避免编译错误。
2732

被折叠的 条评论
为什么被折叠?



