How to know which headers are included without looking at the preprocessed code in GCC?
-
20-08-2019 - |
Question
I've got some big C programs, and I would like to know when I'm compiling this program, which header files are actually included...
The simplest solution would be to print the preprocessed code and look but do you know if there's a way to compile and at the same time showing what header files are included?
Solution
OTHER TIPS
You can use -MD
option - see man gcc
for details.
Increase gcc verbosity and then run it through an own made filter program?
Use gcc -M or gcc -MM. Adjust the output with sed if you like. If you use GNU make (and you should) you can wrap this up a into single tidy command.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow