How do I create a template library so that I can export templates and use them in different programs?
I'm not sure I understand what you mean by "export templates." You can either create a collection of .cpp files, each containing a definition (not just a declaration!) of a template, and #include it in every program that uses this template.
There is another way of doing itnamely, using the export keyword. However, at present, I don't know of any compiler that supports this feature; so, practically, there is only one way to reuse templatesthe one described above.