I've done some searching and have seen this error but in many cases it was caused by missing an include. The header file is underneath "header files" in vs2019 as well
The error is caused in main at Leaf<int> leaf(3);
Here is my main.cpp
#include "heap.h"
#include <iostream>
using namespace std;
int main()
{
//Need to complete testing from main
Heap<int> heap(2);
Leaf<int> leaf(3);
//heap.insert(3);
}
Here is the relevant class in heap.h
template <typename T> class Leaf : public Node<T> {
private:
T key;
public:
Leaf(T value) { key = value; }
virtual Leaf<T>* toLeaf() { return this; }
virtual Leaf<T>* insert(T key, Node<T>*& created) {
Leaf<T>* newLeaf = new Leaf<T>(key);
created = newLeaf;
return newLeaf;
}
};
Error:
Severity Code Description Project File Line Suppression State
Error LNK2001 unresolved external symbol "public: virtual class Leaf<int> * __cdecl Node<int>::insert(int,class Node<int> * &)" (?insert@?$Node@H@@UEAAPEAV?$Leaf@H@@HAEAPEAV1@@Z) 2-3-4 Heap C:\Users\catcal\source\repos\2-3-4 Heap\2-3-4 Heap\main.obj 1