I am using a library that consists almost entirely of templated classes and functions in header files, like this:
// foo.h template
C++0x will fix your compile time issues with extern templates. I don't know an automatic way to do what you ask, though.