I currently have a C++ project that spans two different source control systems. Without checking in the full complete source code from the first system into the second system I plan to check in just the supporting libraries that gets built. My issue is that I will need header files from the first source control system that I use in the second source control system so that I can compile. Is there an easy way of forcing gcc to output all the names of the header files that I use when I compile under Solaris? Is there a way to generate a hierarchy of header file dependencies so that I can see which files are including which other header files? Is it possible for the hierarchy to know about the #pragma once so the dependency tree doesn't include duplicates that aren't included multiple times?
gcc -M to generate the list of header files used by a given source file, or
gcc -MM to omit system headers. The output is in a makefile format, since the option is intended to generate the build dependencies of that source file. There are ways to tweak the output format, see the available preprocessor options in the GCC manual. The default output looks like this:
foo.o: foo.c some_header.h ../include/other_header.h \ ../../common/include/yet_another_header.h
This 1992 paper by some AT&T Research folks describes a tool "incl" that does this for C files, but as far as I know, "incl" never made it out to the great wide world.