Sign in to follow this  
jchmack

linking dependencies (C++)

Recommended Posts

Is there a way to find out what .cpp files need what header files? My project is starting to get really complicated and I am trying to de-couple a lot of these to improve compile times.

Share this post


Link to post
Share on other sites
I guess one of the standard auto-dependency generators that are normally used with gcc would do the trick, but I'm not sure it will tell you what headers are actually *used*. My current strategy is to first strip out any unnecessary includes in the header files. If the definition of class A only uses pointers or references to class B, including B.hpp is not necessary. Avoid master include headers until they really provide fundamental definitions, like configuration preprocessor macros. Only when a cpp complains about a missing definition, you should add it in.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this