Hi all
I get this linker error in my project and I'm unable to find the reason
for it. I checked all topics in this list but without any success. The
problem looks like this (this is a simplified version with just the
basic code related to the error):
---- Arrays.h ----
template <class T>
class Array
{
public:
Array();
};
---- Arrays.cpp ----
template <class T>
Array<T>::Array()
{
}
---- MyApp.cpp ----
#include "Arrays.h"
void SomeFunc()
{
Array<int>* array = new Array<int>();
}
This compiles ok, but the linker complains with the error:
"MyApp.cpp: 'Array<int>::Array()' referenced rom 'SomeFunc' is
undefined."
I use CW 8.2 and SDK 5r3. I can solve the problem by moving all Array
related functions to the Array.h and inline them, but it looks like I
always end with this problem after a while (with a different class).
What am I missing?