Problem using a template outside a DLL library

Hi,

I've got a problem using a template outside a DLL library!!!

I’ve got a Class TestClass. In TestClass, I’ve got a standard function and a template function in the class:

1
2
3
4
5
6
7
8
9
10
int stdFunction()
{
	return 10;
}

template<class T>
T testTemplate(T arg)
{
	return arg;
}


The TestClass is in a DLL library - TestDLL. I’m able to call the stdFunction and testTemplate function from any classes in TestDLL using:

1
2
3
4
5
...
TestClass tc = gcnew TestClass;
int i;
i = tc-> testTemplate(10);
...


The problem is when I try to call the testTemplate function from a class outside the DLL - a class that use the TestDLL. I can call the stdFunction without any problem, but if I call the testTemplate, with the exact same syntax than above, the compiler gives this error:

error C2039: 'testTemplate' : is not a member of 'TestDLL:: TestClass'.
c:\visual studio 2010\projects\testprogs\debug\testdll.dll : see declaration of 'TestDLL:: TestClass'


WHY ???
Topic archived. No new replies allowed.