Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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]?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
112 views
Welcome To Ask or Share your Answers For Others

1 Answer

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...