mam 4 pliki:
rect.cpp / .h (kod ponizej)
test.cpp / .h
Gdy w test.cpp includuje "rect.h" to zglasza "error LNK2019: unresolved external symbol", a kiedy includuje "rect.cpp" to dziala bezproblemu.
Pytanie: Czemu trzeba includowac rect.cpp, zeby projekt sie skompilowal?
Zaznaczam ze kompiluje jako biblioteke DLL w MS VC 2005 Express
rect.cpp
template <class T>
CRect<T>::CRect(T t, T l, T w, T h) : CMain("CRect")
{
top=t;
left=l;
width=w;
height=h;
}
template <class T>
CRect<T>::~CRect()
{
}
// ...
rect.h
template <class T>
class DLLAPI CRect : public CMain
{
public:
CRect(T t, T l, T w, T h);
~CRect();
// ...
};