I tried using the code analysis in Visual Studio 2017 but I got so many 
warnings from Qt headers it wasn't much use. I finally managed to get a 
solution out of Microsoft and I thought others might be interested:

If you open your .vcxproj file, down the bottom you should see:
  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
  <ImportGroup Label="ExtensionTargets">
  </ImportGroup>

below this you can add:
  <PropertyGroup Condition="'$(Language)'=='C++'">
    <IncludePath>$(QTDIR)\include;.\GeneratedFiles;$(IncludePath)</IncludePath>
    
<CAExcludePath>$(QTDIR)\include;.\GeneratedFiles;$(CAExcludePath)</CAExcludePath>
  </PropertyGroup>

Microsoft say there's a bug where CAExcludePath is overwritten by IncludePath 
but this is fixed in Visual Studio 2017 V15.3 and you'll only need to set 
CAExcludePath - I haven't verified this.

The answer is also here for future reference: 
https://stackoverflow.com/questions/43755499/suppress-warnings-for-external-headers-in-vs2017-code-analysis

Tom Isaacson

_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to