Generating a dependency graph and dependency file

Hi there.

I am trying to generate a list of include dependencies of a specific cpp file using the option -dependency-file of clang 3.5 on Unbuntu 12.04 LTS. I have tried using it in the following way:

clang++ -MM -dependency-file hello_includes.txt hello.cpp


clang++ -MM hello.cpp -Xpreprocessor -dependency-file hello_includes.txt

but have been unable to make it work.

clang: warning: argument unused during compilation: ‘-dependency-file hello_include.txt’

So, I was wondering if this feature is actually supported ? ( I am confused as the it shows up in the clang user help but is not contained in the User Manual ). Thank you for your help.

Samrat Roy.

Please use the same option as with GCC:

clang++ -MM hello.cpp


clang++ -MM -MF deps.txt hello.cpp

-dependency-file is an internal option and should not be used directly.


+ cfe-users