Move the contents of SelectionSort.cpp
to SelectionSort.h
, just below the class declaration. Also ensure that you have a header guard around the contents of your entire .h
file.
The problem comes from how C++ implements templates. Every time it sees a new type used with a template class (like Selection<int>
), it recreates the entire class, replacing ItemType
with int
.
For this reason, it needs to know the full definition of the class (along with its methods) at compile time. It cannot just use the class definition and delay linking until later.