Do you know tool building tree of include files in project\file?
Not entirely sure this is what you're after, but you can easily get a list of includes by generating the post-CPP-processed file from the base c file, and grepping out the file/line number comments, e.g., using gcc
gcc -E main.c {usual flags} | grep '#' | cut -d' ' -f3 | sort | uniq
where main.c is your base c file.
View the include tree in a C/C++ project
Try Eclipse CDT. It has Include Browser.
Displaying the #include hierarchy for a C++ file in Visual Studio
There is a setting:
Project Settings -> Configuration Properties -> C/C++ -> Advanced -> Show Includes
that will generate the tree. It maps to the compiler switch /showIncludes
How should I detect unnecessary #include files in a large C++ project?
While it won't reveal unneeded include files, Visual studio has a setting /showIncludes
(right click on a .cpp
file, Properties->C/C++->Advanced
) that will output a tree of all included files at compile time. This can help in identifying files that shouldn't need to be included.
You can also take a look at the pimpl idiom to let you get away with fewer header file dependencies to make it easier to see the cruft that you can remove.
Show #include hierarchy in C++Builder
Sadly, there are no Borland C Compiler options for displaying the hierarchy of #include
d files. See Embarcadero's BCC32 CLI docs.
However, an alternative (granted, not as clean) is to use the Borland C Compiler Preprocessor, e.g.
CPP32 -Sr source.cpp # outputs source.i with comments and indentation retained
Tool to track #include dependencies
If you have access to GCC/G++, then the -M
option will output the dependency list. It doesn't do any of the extra stuff that the other tools do, but since it is coming from the compiler, there is no chance that it will pick up files from the "wrong" place.
VS2010 How to include files in project, to copy them to build output directory automatically during build or publish
There is and it is not dependent on post build events.
Add the file to your project, then in the file properties select under "Copy to Output Directory" either "Copy Always" or "Copy if Newer".
See MSDN.
How can I see the C/C++ #include graph easily?
Doxygen, with the aid of Graphviz, can do that. You first need to edit a configuration file. This won't be easy the first time you do it, but no much editing is needed afterwards.
Detecting superfluous #includes in C/C++?
It's not automatic, but doxygen will produce dependency diagrams for #included
files. You will have to go through them visually, but they can be very useful for getting a picture of what is using what.
Related Topics
How to Alter Qt Widgets in Winapi Threads
Is There Any Danger in Calling Free() or Delete Instead of Delete[]
How Does Url Within Function Body Get Compiled
Stl Random Distributions and Portability
What Modern C++ Libraries Should Be in My Toolbox
How to Get Duration, as Int Milli's and Float Seconds from <Chrono>
Modifying Vertex Properties in a Boost::Graph
Is There a Readable Implementation of the Stl
What Changes Introduced in C++14 Can Potentially Break a Program Written in C++11
Removing Duplicate Characters from String Using Stl
Error: Expression Must Have a Class Type
How to Treat a Specific Warning as an Error
Why Does My Cout Output Not Appear Immediately
How to Make My Program in Qt Continually Send a String to My Arduino