caller below when linking saids undefined reference...
in base.h file:
class tempc {
public:
int a;
} ;
class base // base class
{
public: // public
template<T> int func(T*); // template defined here
};
in base.cpp file:
template<T>
int base :: func(T*)
{
std::cout << "base::func called" << std::endl;
return 0;
}
in derived.cpp file
class derived : public: base // class defined
{
void caller()
{
tempc a;
func<tempc>(&a); // template used here
base::func<tempc>(&a);
}
};
int main()
{
derived d;
d.caller();
}
the error is : undefined reference to `void base::func(tempc*)'
base is the base class
derived is the derived class from base
this caller saids undefined reference...
//sorry,because my source code is reaaaaly too large to show up