I suggest you ...

make header include refactoring possible

This suggestion is migrated to Developer Community. Please use below link to view the current status.
https://developercommunity.visualstudio.com/content/idea/351244/make-header-include-refactoring-possible.html
Would be great to have a tool which will automatically remove unused headers. I a big projects (more than 1^6 LOC ) this becomes really both code and compile-time issue over the time.

Another idea is to move from precompiled header those header files which are used only once and move those used more than once into precompiled header. Ideally those thresholds are configurable.

914 votes
Vote
Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
You have left! (?) (thinking…)
Roman Malytskyy shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

4 comments

Sign in
(thinking…)
Sign in with: facebook google
Signed in as (Sign out)
Submitting...
  • Philip Sansone commented  ·   ·  Flag as inappropriate

    I work on a large project with a long history and some files have enough unnecessary includes to add a 15% penalty to the compilation time. Letting Visual Studio run overnight (if necessary) to get rid of all the unnecessary includes would be a big win.

    Also, the feature may want to ignore precompile directives that turn off code (except #if 0) so codebases that have a lot of switches don't have to run the tool separately for each configuration.

    Google has a tool called include-what-you-use. It would be nice to have such a tool integrated into Visual C++.

  • Aaron Daily commented  ·   ·  Flag as inappropriate

    This tool should also help manage "using" statements.

    And it should suggest forward declarations which would remove further includes.

Feedback and Knowledge Base