error LNK2019: dllimport with multiple template instantiations

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.

My class looks like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39

#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
	*/
	static const Vector3<T> UP;
	/**
	Global vector for down
	*/
	static const Vector3<T> DOWN;
	/**
	Global vector for left
	*/
	static const Vector3<T> LEFT;
	/**
	Global vector for right
	*/
	static const Vector3<T> RIGHT;
	/**
	Global vector for forward
	*/
	static const Vector3<T> FORWARD;
	/**
	Global vector for backward
	*/
	static const 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
Last edited on
Topic archived. No new replies allowed.