I don’t know if this makes a difference, but I am using VS c++ 6.0
Linking…
vid3Dlg.obj : error LNK2001: unresolved external symbol "public: double __thiscall Image::jdlMin(double,double)" (?jdlMin@Image@@QAENNN@Z)
Debug/vid3.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
I tried this also:
template <class T> T Image::jdlMin( T a, T b )
and I get same error.
//Image.h
class Image
{
public:
Image();
virtual ~Image();
template <class T> T jdlMin( T a, T b );
}
//Image.cpp
Image::Image()
{
}
Image::~Image()
{
}
template <class T> T jdlMin( T a, T b )
//I tried this also: template <class T> T Image::jdlMin( T a, T b )
{
return ( a < b );// ? a : b;
}
//CVid3Dlg.cpp
void CVid3Dlg::exTemplate()
{
Image *im = new Image();
int s=0;
s = im->jdlMin((double)3,(double)4); //
}
This time, i compiled it (under VC++ 10) to test the functionality:
Hope that helps…
Bye the way, i took a look into a good C++ documentation: “class T” and “typename T” have exactly the same meaning and behave exactly the same way… 😉