Possible Duplicates:
C/C++: Detecting superfluous #includes?
How should I detect unnecessary #include files in a large C++ project?
Hi,
I've been following numerous discussions about how to reduce the build time for C/C++ projects. Usually, a good optimization is to get rid of #include statements by using forward declarations. Now, I was wondering:
Is there maybe a tool which can compute the #include dependency tree between C/C++ header files (I know mkdep on Linux can do this) and then starts a 'remove header file/recompile' cycle? It would be great if the tool could try to remove nodes from the dependency tree (e.g. remove #include statments from files) and then rebuild the project to see whether it still works.
It shouldn't need to be very clever (as in, refactoring the code to make header files unnecessary by using pointers instead of values or the like) but I believe many projects I worked on had plain unneeded #include statements. This usually happens by refactoring code and moving it around, but then forgetting to take the #include out.
Does anybody know whether a tool like this exists?