Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have read about the error on the internet, and it said it could be a name mismatch. But it's not i have checked, all the names are the same in the .h and .cpp file. So basically this is how it looks in the header(.h):
C++
template <class T> class GameArray {
private:
  T* array;
public:
  GameArray(); //The constructor
};

And the source (.cpp):
C++
template <class T>
GameArray<T>::GameArray() {}


What I have tried:

I have tried different types of making class work, and this is according to the internet the way to go about it.
Posted
Updated 18-Nov-21 10:57am

1 solution

Just define the method as you declare it in the header file, you do not need/can't have a .cpp file here.
C++
template <class T> class GameArray {
private:
  T* array;
public:
  GameArray() { } //The constructor
};
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900