9


I see that VC++ includes an option called /show include to list you the hierarchy of include files in each translation unit. This seems to be a very helpful option - to optimise/improve the compilation time in a large scale project.

Question
Is there any equivalent option in GNU g++ compiler to get these (similar output)?

Jonathan Leffler
  • 730,956
  • 141
  • 904
  • 1,278
kumar_m_kiran
  • 3,982
  • 4
  • 47
  • 72

2 Answers2

16
gcc -H

will print the names of header files as they are used.

Brent Bradburn
  • 51,587
  • 17
  • 154
  • 173
Bulletmagnet
  • 5,665
  • 2
  • 26
  • 56
8

There's a variety of options for controlling this.

-MD will list files, -MMD will list non-system files as side effects of compilation

-M, -MM will generate lists instead of compiling.

-MQ, -MG, -MP and -MT generate makefile target fragments. -MF allows you to specify an output filename.

KatieL
  • 96
  • 1