Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

list of all header files included by a C file

Tags:

c++

c

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 list of all the header files it includes?

like image 701
carte blanche Avatar asked Apr 12 '13 16:04

carte blanche


People also ask

How many C header files are there?

There are 19 header files in the Standard C Library.

Where all header files are stored in C?

The angle brackets (<>) cause the preprocessor to search for the header file in the standard place for header files on your system, usually the /usr/include directory.

What is included in a header file?

Header files can include any legal C source code. They are most often used to include external variable declarations, macro definitions, type definitions, and function declarations.


1 Answers

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
like image 185
piokuc Avatar answered Oct 16 '22 07:10

piokuc