Say, I'd like to have a tool (or script?) taking project (or .h file) and building searchable tree of "includes" included into it (of included into of included into and so so on). Is there exist something like this? Should I write this by myself [of course I am :), but may be somebody had it already written or may be has an idea how to get it]?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- thread_local variables initialization
- What uses more memory in c++? An 2 ints or 2 funct
相关文章
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
- Converting glm::lookat matrix to quaternion and ba
- What is the correct way to declare and use a 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
where main.c is your base c file.
I know this is an old question, a slightly more useful output than the gcc/g++ -E output alone would also used the -H flag (instead or in addition to):
g++ -H {my -I and other flags} -E -o /dev/null file.cpp
here is a sample output, tree structure helps figure out who included what as a bonus it also lists at the bottom which files may benefit from an include guard
Include Finder is a pretty useful tool. It has some bugs, and hasn't been updated in a while, but the author does provide the source, so you can modify it to your liking.
If I remember correctly, doxygen can do this.
Eclipse CDT has the Include Browser under Window --> Show View --> Other... --> C/C++ --> Include Browser.