Sign in to follow this  
warp X

More files, more compiling time?

Recommended Posts

My compiling time is starting to get longer and longer (Not that long though). It seems that when I add .h and .cpp files to the project, the compiling time increases. A thorough compiling is needed usually when header files are changed. I'm using MS VS.NET 2003. Is this true? Would it make any sense to have some, for example small derived, classes in same files? I'm also going nuts when there's too much separate files because the navigation system sucks a bit. It's not that handy.

Share this post

Link to post
Share on other sites
Obviously, if a header file changes, every file that includes it has to be recompiled. Here are some ways to reduce compile times related to header files:
  • Use precompiled headers.
  • Never use a header file that includes every other header file (except when using PCH of course).
  • Only include the header files that are needed by that file.
  • Do not put implementation details in header files.
  • Use forward declarations whenever possible.

It is acceptable to have several small related classes in the same file.

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