Removing unused includes
Asked Answered
S

3

7

Are there any tools which parse .h files and recommend the removal of #includes. For example if the defines in the include are not being used or if it is possible to do a forward declaration instead.

I work on both windows and linux platforms.

Suitor answered 6/11, 2012 at 12:42 Comment(3)
possible duplicate of C/C++: Detecting superfluous #includes?Vaccinia
This isn't a 'tool' but.. generally you won't have too many includes - you could just do it manually! comment out, compile - if it fails keep it otherwise remove it and then repeat.Interim
a good answer to a similar question can be found here: https://mcmap.net/q/92478/-detecting-superfluous-includes-in-c-cWorkmanlike
A
5

include-what-you-use is intended to do this.

Affectation answered 6/11, 2012 at 12:44 Comment(0)
F
3

ReDHead is a project for exactly that. It's an Eclipse plug-in.

Fritzie answered 6/11, 2012 at 12:44 Comment(0)
A
3

I was looking for such tool some time ago and I now found out that this functionality is also provided by Resharper C++ plugin for Visual Studio.

Adjudicate answered 9/12, 2016 at 15:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.