每次创建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文章来源:https://www.toymoban.com/news/detail-618360.html
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‘这种莫名其妙的错误文章来源地址https://www.toymoban.com/news/detail-618360.html
到了这里,关于VS2022永久添加IncludePath的方法的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!