Header analysis in Visual Studio

Header Analysis allows you to fix problems with the include structure of your code, which can add to compile time and make the system difficult to maintain.

In Visual Studio, unnecessary or missing transitive includes are reported in the issue list as one of the following issues: HA.DUPLICATE, HA.OPTIMIZE or HA.UNUSED.

Note: There are no markers for header analysis issues.

  1. To solve a Header Analysis issue manually, double-click on the issue found in the issues list. This will bring you to the line of code containing the issue.
  2. Right-click the issue marker and a pop-up menu will appear with the following possible actions:

Once you make a change, the issue will disappear from the issue list.

If you prefer to make these changes automatically, you can right click anywhere in your current file and select Klocwork > Optimize headers. This will automatically fix all header issues within the current file.

To prevent these issues from appearing in the issue list see, disable the Header Analysis checkers.