(Number of source files is pretty unimportant to the linker in any case. The linker scales by symbol count and code size, not by translation unit count, generally speaking. The worse case you can get into is having headers or the like that bloat symbol count per TU and then have a lot of TUs, giving a multiplicative effect, but... well, don't do that.)
This is a good point... and probably more important to keeping compile times low than using a dynamic or static lib config. I see pro-coders do this and it bugs me. I think people coming over from C# or Java tend to be the culprits.
...As a general rule, if a class is referenced in a header as a pointer or reference type then you don't need to include the header file with the declaration for the type. A simple forward declare is enough.
i.e. the following example would be found in header files...
//header includes
class CForwardDeclared;
//class declarations + codes
or you can do it in the code. (i personally like to do it this way)
class CSomeClass
{
public:
CSomeClass(const class CSomeConstDataOrSomething& InData);
const class CSomeConstDataOrSomething& Data;
void SomeFunction(class CSomeOtherClass* ptr);
};
Same goes for template instantiation parameters
TWeakPtr<class CSomeClass> SomeClassPointer;
This also means that changes to the header files wont dirty any unecussary TU's which will just result in less compiling generally.
... but this will not help with linker times, so still better to use DLL's as well anyway.