Do you know tool building tree of include files in project\file?

前端 未结 6 1859
臣服心动
臣服心动 2020-12-03 23:59

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 s

6条回答
  •  星月不相逢
    2020-12-04 00:27

    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.

提交回复
热议问题