Print Header File Includes After Preprocessing
You can use gcc -M
to print all the dependencies of a C source file. For example:1gcc -I../my/include/path -M my_header.h
To see the resulting file after all those includes, you can cat
them together:1gcc -I../my/include/path -M my_header.h | tr -d '\\\n' | cut -d' ' -f2- | xargs cat
Then, to print all the preprocessor #define
s, excluding the predefined ones:1gcc -I../my/include/path -M my_header.h | tr -d '\\\n' | cut -d' ' -f2- | xargs cat | cpp -E -fpreprocessed -dM