Hi, I've run into a nagging problem and I hope somebody can help me.
I'm using visual studio 2008
I have a template vector class in a dll that I am exporting via '_declspec (dllexport)', and I'm trying to import it via '_declspec (dllimport)' in my client application. I can instantiate the class with only one type in a source file of my client application.
#ifdef EE_EXPORT
#define EE_API _declspec (dllexport)
#else
#define EE_API _declspec (dllimport)
#endif
template <typename T>
struct EE_API Vector3
{
/**
Global vector for up
*/
staticconst Vector3<T> UP;
/**
Global vector for down
*/
staticconst Vector3<T> DOWN;
/**
Global vector for left
*/
staticconst Vector3<T> LEFT;
/**
Global vector for right
*/
staticconst Vector3<T> RIGHT;
/**
Global vector for forward
*/
staticconst Vector3<T> FORWARD;
/**
Global vector for backward
*/
staticconst Vector3<T> BACKWARD;
T x;
T y;
T z;
};
If I do this in my client application:
1 2
Vector3<float> testFloat;
Vector3<int> testInt;
I get a link error:
LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall Vector3<int>::Vector3<int>(void)" ...
If anybody has any tips or suggestions I would really appreciate it,
thanks