Hi I'm newbie on the linked list concept and I'm trying to write a program that can basically allow a user to store information into a linked list with the basic functions: append, delete, display, etc.
My header file:
The Cpp file for it:Code://Specification file for the ScheduleList class #ifndef SCHEDULELIST_H #define SCHEDULELIST_H #include <iostream> class ScheduleList { private: struct ListNode { int number; ListNode *next; }; ListNode *head; public: ScheduleList() { head = NULL;} ~ScheduleList(); void appendNode(int); //void deleteNode(); // void displayList(); }; #endif
and my Main cpp file:Code://Implementation file for the ScheduleList class #include "ScheduleList.h" #include <iostream> using namespace std; void ScheduleList::appendNode(int num) { ListNode *newNode, *nodeptr; newNode = new ListNode; newNode->number = num; newNode->next=NULL; if(!head) head = newNode; else { nodeptr = head; while(nodeptr->next) nodeptr=nodeptr->next; nodeptr->next = newNode; } }
Anyways, it's not much so far but that's because I'm trying to do little by little so that I can be sure that it is working.Code://Linked List Project //Notes - http://www.functionx.com/cpp/articles/linkedlist.htm #include <iostream> #include "ScheduleList.h" using namespace std; int main() { ScheduleList student; student.appendNode(2); return 0; }
Whenever I try and compile, it keeps giving me these same 3 error messages:
I have read through many forums, but I am still clueless as to what exactly the problem is.Code:main.obj : error LNK2001: unresolved external symbol "public: __thiscall ScheduleList::~ScheduleList(void)" (??1ScheduleList@@QAE@XZ) main.obj : error LNK2001: unresolved external symbol "public: void __thiscall ScheduleList::appendNode(int)" (?appendNode@ScheduleList@@QAEXH@Z) Debug/main.exe : fatal error LNK1120: 2 unresolved externals Error executing link.exe.
Any help is greatly appreciated. Thanks.



LinkBack URL
About LinkBacks



