This is for an assignment I am trying to complete. For a previous assignment, I had to create a linked list class for integers. I was able to get that working fine. This assignment is to convert the linked list class into a template so that it can be a linked list of anything.
I figured the best way to start was to take the linked list class for intergers, scale it back to just a few methods, and then convert it to a template.
I converted my two classes. One was a Node class(which had a data member and a pointer to Node) and the other was Linked List (which had the pointer to the head node, a int member to keep track of the number of nodes in the list, and methods to pop, push, insert nodes). For the template version of the LinkedList class I just started with the push method and the constructors and destructors.
With just the .h and .cpp files for the classes defined, the compiling works without error. But when I try to establish a variable of type LinkedList in a harness program I receive the following errors, but am uncertain how to resolve.
--------------------Configuration: Assn5 Template Linked List Class - Win32 Debug--------------------
Assn5_Linked List Class.cpp
Assn5_Linked List Class.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall LinkedList<int>::~LinkedList<int>(void)" (??1?$LinkedList@H@@UAE@XZ)
Assn5_Linked List Class.obj : error LNK2001: unresolved external symbol "public: __thiscall LinkedList<int>::LinkedList<int>(void)" (??0?$LinkedList@H@@QAE@XZ)
Debug/Assn5 Template Linked List Class.exe : fatal error LNK1120: 2 unresolved externals
Error executing link.exe.
Assn5 Template Linked List Class.exe - 3 error(s), 0 warning(s)
I have attached the code I am using ...