Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to find header dependencies for large scale projects on linux [closed]

Tags:

c++

I'm working an a very large scale projects, where the compilation time is very long. What tools can I use (preferably open source) on Linux, to find the most heavily included files and that optimize their useages? Just to be clearer, I need a tool which will, given the dependencies, show me which headers are the most included. By the way, we do use distributed compiling

like image 501
user12371 Avatar asked Sep 17 '08 07:09

user12371


People also ask

Where can I find header files in linux?

Most standard headers are stored in /usr/include . It looks like stdbool. h is stored somewhere else, and depends on which compiler you are using. For example, g++ stores it in /usr/include/c++/4.7.

How do you check if a header file is included?

To check if an header file has been included or not in a C or C++ code, we need to check if the macro defined in the header file is being defined in the client code. Standard header files like math. h have their own unique macro (like _MATH_H ) which we need to check. Consider this example of checking if math.

Does order of header files matter?

Ideally, all header files should be self-contained, and inclusion order should not matter. In practice, people often write header files that are not self-contained, and sometimes inclusion order does matter.


2 Answers

Check out makdepend

like image 93
INS Avatar answered Nov 13 '22 10:11

INS


The answers here will give you tools which track #include dependencies. But there's no mention of optimization and such.

Aside: The book "Large Scale C++ Software Design" should help.

like image 41
Agnel Kurian Avatar answered Nov 13 '22 09:11

Agnel Kurian