I am having a hard time getting this to work
file: myclass.hpp
Class MyClass {
public:
template <class T>
MyClass &operator<<(const T &val);
};
file: myclass.cpp
template <class T>
MyClass &MyClass::operator<<(const T &val) {
...
}
I can compile this in to a object without a problem, But when other functions try to calling it, this error comes up (for every time << was used).
myclass.cpp: undefined reference to `MyClass& MyClass::operator<< <int>(int const&)'
What am I doing wrong?