I'm getting linker errors when trying to compile my code
1>main.obj : error LNK2019: unresolved external symbol "public: __cdecl Grid<class Grid<class PointData *> *>::Grid<class Grid<class PointData *> *>(struct glm::tvec3<float,0>,int,float)" (??0?$Grid@PEAV?$Grid@PEAVPointData@@@@@@QEAA@U?$tvec3@M$0A@@glm@@HM@Z) referenced in function "void __cdecl `dynamic initializer for 'grid''(void)" (??__Egrid@@YAXXZ)
1>main.obj : error LNK2019: unresolved external symbol "public: __cdecl Grid<class Grid<class PointData *> *>::~Grid<class Grid<class PointData *> *>(void)" (??1?$Grid@PEAV?$Grid@PEAVPointData@@@@@@QEAA@XZ) referenced in function "void __cdecl `dynamic atexit destructor for 'grid''(void)" (??__Fgrid@@YAXXZ)
This is the line causing it in main.cpp
Grid<Grid<PointData*>*> grid(glm::vec3(0, 0, 0), 1000, 10000);
Even though I have implemented a template class with the specialization for pointers, I still get the error
template<class T>
class Grid
{...}
template<class T>
class Grid<T*>
{...}
template<class T>
Grid<T>::Grid(glm::vec3 origin, int resolution, float size)
{
grid = new T*[size*size*size];
this.origin = origin;
this.size = size;
this.gresolution = resolution;
this.cell_size = size / resolution;
}
template<class T>
Grid<T*>::Grid(glm::vec3 origin, int resolution, float size)
{
grid = new T*[size*size*size];
this.origin = origin;
this.size = size;
this.gresolution = resolution;
this.cell_size = size / resolution;
}
What am I doing wrong here? Thanks in advance!