Print Header File Includes After Preprocessing

You can use gcc -M to print all the dependencies of a C source file. For example:

1
gcc -I../my/include/path -M my_header.h

To see the resulting file after all those includes, you can cat them together:

1
gcc -I../my/include/path -M my_header.h | tr -d '\\\n' | cut -d' ' -f2- | xargs cat

Then, to print all the preprocessor #defines, excluding the predefined ones:

1
gcc -I../my/include/path -M my_header.h | tr -d '\\\n' | cut -d' ' -f2- | xargs cat | cpp -E -fpreprocessed -dM