Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are some techniques for limiting compilation dependencies in C++ projects?

In a C++ project, compilation dependencies can make a software project difficult to maintain. What are some of the best practices for limiting dependencies, both within a module and across modules?

like image 649
JohnMcG Avatar asked Oct 09 '08 18:10

JohnMcG


2 Answers

  • Forward Declarations
  • Abstract Interfaces
  • The Pimpl Idiom
like image 96
luke Avatar answered Nov 16 '22 09:11

luke


Herb Sutter has a great treatment of this exact topic in Items 26, 27 and 28, "Minimizing Compile-time Dependencies, Parts 1, 2 and 3", in his excellent book Exceptional C++, ISBN: 0201615622.

alt text http://ak.buy.com/db_assets/prod_images/489/30611489.jpg

IMHO, this is one of the best C++ programming books available.

like image 6
jwfearn Avatar answered Nov 16 '22 09:11

jwfearn