So I am getting an unresolved external symbol error and I can't figure out why. All files exist in the same project and the compiler seems to be generating all the obj files. I am deriving from a template class so I am thinking maybe I am not declaring my derived methods properly. I am using the visual c++ compiler in VS 2012.
BaseClass.h
template<class T> class BaseClass
{
public:
BaseClass() {}
virtual ~BaseClass() {}
void Foo();
}
BaseClass.cpp
#include "BaseClass.h"
template<class T> void BaseClass<T>::Foo()
{
cout << "hello";
}
SomeClass.h
#include "BaseClass.h"
class SomeClass : public BaseClass<long>
{
public:
SomeClass() {}
void DoSomething();
}
SomeClass.cpp
#include "SomeClass.h"
void SomeClass::DoSomething()
{
Foo(); // link error
this->Foo(); // also gives link error
BaseClass<long>::Foo(); // also gives link error
}
So method DoSomething() can't seem to invoke anything from its base class due to link error. Is there something obvious here I am doing wrong?