Shortening C++ compilation times

What can be done to make compilation times shorter?

There are a few things programmers should care about.

  • Use forward declarations wherever applicable.

  • Clean up unused includes. Tools like Resharper C++ or Rider IDE highlights unused includes in the opened source file.

  • Use "the lowest possible class in the hierarchy", i.e. include engine's PlayerController.h instead of your extended version if you don't need anything from your overridden class.

  • Put common types (enums, structs) into separate headers like "MyProjectTypes.h" or "InventoryTypes.h". This way you wouldn't have to include the entire InventoryComponent class when another class just needs a struct holding InventoryItem definition. So you don't add classes used by InventoryComponent to the dependency chain

  • Don't forget about proper code architecture. Think all the time how to minimize dependencies between classes and systems.

MothDoctor Last updated on