   Templates and linking problems
  Hi!I have the following code, in the specified files: |test.h|template <class X>class test{public:test(){}~test(){}public: void func();};|test.cpp|#include "test.h"template <class X>void test<X>::func(){}|main.cpp|#include "test.h"int main(){test<int> foo;foo.func();return 1;}Compiles correctly but gives me error LNK2019 (symbol not found) for func().  I am using MSVC .NET.Thanks for any help!!   ph0ng^_^wh0ng[edited by - ph0ngwh0ng on February 12, 2004 3:54:34 PM]
  Search the board before posting, this comes up every week. ;  You can''t do separate compilation of template function or template member function implementations with MSVC. In order for this code to work, you need to move the function implementations into the header with the declarations. (or include them as a inl file, or the moral equivilant.) ;  Oh! Sorry.   ph0ng^_^wh0ng 