list of all header files included by a C file

后端 未结 3 1227
傲寒
傲寒 2020-12-20 15:13

I am trying to \"arm\" compile a C file,it includes lot of header files recursively..i am trying to find the list of these header files..is there a easier way to find the li

3条回答
  •  青春惊慌失措
    2020-12-20 15:26

    You can use the GCC C preprocessor with it's option to dump a list of headers recursively included:

    cpp -M
    

    That will show you all headers included.

    You will probably need to give it the roots of all include directories used in your regular build. Run it iteratively, adding more include paths until the errors stop.

    The full form of this command in this usage is:

    cpp -M [-I include_directory *] path_to_c_file.c
    

提交回复
热议问题