Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are there tools that help organizing #includes?

Tags:

Are there any tools that help organizing the #includes that belong at the top of a .c or .h file?

I was just wondering because I am reorganizing my code, moving various small function definitions/declarations from one long file into different smaller files. Now each of the smaller files needs a subset of the #includes that were at the top of the long file.

It's just annoying and error-prone to figure out all #includes by hand. Often the code compiles even though not all #includes are there. Example: File A uses std::vector extensively but doesn't include vector; but it currently includes some obscure other header which happens to include vector (maybe through some recursive includes).

like image 973
Frank Avatar asked Sep 04 '10 22:09

Frank


People also ask

Is a helpful tool for organizing your work?

Trello. Trello is the most famous organizing tool of all when it comes to managing your work activities. This application allows you to track and visualize the proper progress of your activities going forward.


1 Answers

VisualAssistX can help you jumping to the definition of a type. E.g. if you use a class MyClass in your source, you can click it, choose goto definition, and VisualAssistX opens the include file that contains the definition of this class (possibly Visual Studio can also do this, but at this point am so getting used to VisualAssistX, that I contribute every wonderful feature to VisualAssistX :-)). You can use this to find the include file necessary for your source code.

PC-Lint can do exactly the opposite. If you have an include file in your source that is not being used, PC-Lint can warn you about it, so that you know that the include file can be removed from the source (which will have a positive impact on your compilation time).

like image 52
Patrick Avatar answered Sep 27 '22 20:09

Patrick