   Link Error
  This is the header file I'm trying to use://Templates.h#include "Datatypes.h"#pragma oncetemplate <class DataType> class HashListNode{DataType Data;DWORD dwKey;DataType *next;};template <class DataType> class CHashTable{public:DataType Get(DWORD dwID);CHashTable(DWORD dwNumOfLists = 101);~CHashTable();ErrorMessage Add(DWORD dwKey, DataType tData);ErrorMessage Get(DWORD dwKey, DataType &tReturnData);private:DWORD hash(DWORD dwKey);private:HashListNode<DataType> **m_ppTable;DWORD m_dwNumOfLists, m_dwNumOfItems;};But when I add the header to one of my other source files, I get the following errors. When trying to use the class CHashTable.Alpha 0.4 - Client error LNK2019: unresolved external symbol "public: __thiscall CHashTable<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::~CHashTable<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(void)" (??1?$CHashTable@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE@XZ) referenced in function "public: __thiscall CTextureManager::~CTextureManager(void)" (??1CTextureManager@@QAE@XZ)Alpha 0.4 - Client error LNK2019: unresolved external symbol "public: __thiscall CHashTable<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::CHashTable<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >(unsigned long)" (??0?$CHashTable@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE@K@Z) referenced in function "public: __thiscall CTextureManager::CTextureManager(void)" (??0CTextureManager@@QAE@XZ)Alpha 0.4 - Client error LNK2019: unresolved external symbol "public: enum ErrorMessage __thiscall CHashTable<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Add(unsigned long,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?Add@?$CHashTable@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE?AW4ErrorMessage@@KV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: enum ErrorMessage __thiscall CTextureManager::AddTexture(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned long)" (?AddTexture@CTextureManager@@QAE?AW4ErrorMessage@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@K@Z)Alpha 0.4 - Client error LNK2019: unresolved external symbol "public: enum ErrorMessage __thiscall CHashTable<class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > >::Get(unsigned long,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > &)" (?Get@?$CHashTable@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@@QAE?AW4ErrorMessage@@KAAV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function "public: enum ErrorMessage __thiscall CTextureManager::AddTexture(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >,unsigned long)" (?AddTexture@CTextureManager@@QAE?AW4ErrorMessage@@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@K@Z)Alpha 0.4 - Client fatal error LNK1120: 4 unresolved externalsI thought it must be that I forgot to add "Templates.h" and "Templates.cpp" to my project, but that's not the case, they're both part of the project.Is there something I missed? I'm using Visual C++ .Net 2003.   
  The implementation of template functions can't be in there own .cpp file they have to be in the .h file with their declarations. In other words copy and paste templates.cpp into templates.h and remove templates.cpp from your project.   ;  Ahh I see, no wonder I couldn't figure it out. Thanks!!Is there a reason for that? I can't see a reason not to allow the definitions to be in a seperate file.   ;  Well, the "export" keyword allows you to do that, but it's not supported in visual studio. Not sure why, ask Bill :)   ;  Templates need access to the implementation when it creates functions for all the datatypes.You could put an include at the end of the .h file to include the implementation if you want them in separate files.   