I'm having trouble with this code:

 ``123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117`` ``````#include #include using namespace std; #ifndef Null #define Null 0 #endif class Node { public: int data; Node *link; }; class LList { public: LList (); ~LList(); void create(); void display(); Node* getNode(); void append(Node* NewNode); void insert(Node *NewNode, int pos); void rtraverse(); void deleteNode(int deletePos); private: Node *Head, *Tail; void recursiveTraverse (Node *tmp) { if (tmp == Null) { return; } cout << tmp->data << "\t"; recursiveTraverse (tmp->link); } }; LList :: ~LList () { Node *Temp; while (Head != Null) { Temp = Head; Head = Head->link; delete Temp; } } void LList :: create () { char ans; Node *NewNode; while (1) { cout << "Any more nodes to be added (Y/N):"; cin >> ans; if (ans == 'n' || ans == 'N') { break; } NewNode = getNode (); append(NewNode); } } void LList :: append(Node* NewNode) { if (Head == Null) { Head = NewNode; Tail = NewNode; } else { Tail->link = NewNode; Tail = NewNode; } } Node* LList :: getNode() { Node *Newnode; Newnode = new Node; cin >> Newnode->data; Newnode->link = Null; return (Newnode); } void LList :: display() { Node *temp = Head; if (temp == Null) { cout << "Empty List"; } else { while(temp != Null) { cout << temp->data << "\t"; temp = temp->link; } } cout << endl; } int main() { LList L1; L1.create(); L1.display(); return 0; }``````

I get an error "[Linker error] PATHNAME:(.text+0x1b2): undefined reference to ~LList::LList()' "

Any idea what is going on here... Thanks.
No constructor here.. Thats why...duh !
http://ideone.com/N3EXgI
gcc wrote:
In function `main':
prog.cpp:(.text.startup+0x13): undefined reference to `LList::LList()'
On line 19 you declare that there exists a default ctor, but where do you define such a thing? Your compiler can't find it because neither can you.
Topic archived. No new replies allowed.