 <p>The compiler needs to have access to the entire template definition (not just the signature) of <code>addItem</code> in order to generate code for each instantiation of the template, so you need to move its definition to your header i.e follow the <a href="http://books.google.com/books?id=EotSAwuBkJoC&amp;pg=PA61&amp;lpg=PA61&amp;dq=Inclusion+model+in+templates&amp;source=bl&amp;ots=iwO-H5_f8b&amp;sig=_lQy9I36pfxWuU5iIw1IDCw-uK0&amp;hl=en&amp;ei=guCOTMbqGJHyvQPzs9DUCw&amp;sa=X&amp;oi=book_result&amp;ct=result&amp;resnum=3&amp;ved=0CBwQ6AEwAg#v=onepage&amp;q=Inclusion%20model%20in%20templates&amp;f=false" rel="nofollow">inclusion model</a>.</p> <p>Infact modern C++ compilers do not easily support the separate compilation model for templates.</p>