Finding all #includes in a file using libclang and Python
For a good introduction in to using libclang and Python see here.
Assuming that you can or have built libclang with the Python bindings, below is a script that loops through all the #include statements in a single C/C++ file printing out the files they reference.