Find headers required by a cpp file

less than 1 minute read

In order to find out which headers each .cpp file requires, perform a g++ -MM file.cpp. This lists out the dependencies for converting file.cpp into an object file. man g++ and do a /-M for the whole list of sub-options. -MM does not list system libraries.

Leave a Comment