[Interest] Using VS2017 Code Analysis with Qt

Tom Isaacson Tom.Isaacson at navico.com
Tue Jun 20 00:50:32 CEST 2017

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">

below this you can add:
  <PropertyGroup Condition="'$(Language)'=='C++'">

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

More information about the Interest mailing list