I'm having some trouble with template class declarations and definitions, especially when they are split across several files.
As a test example, I did this:
In file "test.h", I declared:
In file "test.cpp", I defined:
void set_t(T k);
and my main procedure is a very simple:
void test<T>::set_t(T k)
t = k;
(as you can see, I'm using VC++ 2003)
int _tmain(int argc, _TCHAR* argv)
The problem is, my compiler keeps giving me a hard time about:
template_test error LNK2019: unresolved external symbol "public: void __thiscall test<int>::set_t(int)" (?set_t@?$test@H@@QAEXH@Z) referenced in function _main
It works fine if I just keep the function definition and declaration together, but obviously, I want to know how to split the two.
Thanks in advance, people.