每次创建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‘这种莫名其妙的错误