Unresolved externals..
I've been staring at this and don't understand why I have these unresolved externals
LinkedList.obj : error LNK2019: unresolved external symbol "public: class Node * __thiscall Node::getNext(void)" (?getNext@Node@@QAEPAV1@XZ) referenced in function "public: void __thiscall LinkedList::print(void)" (?print@LinkedList@@QAEXXZ)
LinkedList.obj : error LNK2019: unresolved external symbol "public: int __thiscall Node::getData(void)" (?getData@Node@@QAEHXZ) referenced in function "public: void __thiscall LinkedList::print(void)" (?print@LinkedList@@QAEXXZ)
LinkedList.obj : error LNK2019: unresolved external symbol "public: __thiscall Node::Node(int,class Node *)" (??0Node@@QAE@HPAV0@@Z) referenced in function "public: void __thiscall LinkedList::prepend(int)" (?prepend@LinkedList@@QAEXH@Z)
LinkedList.obj : error LNK2019: unresolved external symbol "public: void __thiscall Node::setNext(class Node *)" (?setNext@Node@@QAEXPAV1@@Z) referenced in function "public: void __thiscall LinkedList::insert(int)" (?insert@LinkedList@@QAEXH@Z) |
My code where the problems are is:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
void LinkedList::print()
{
Node* cur = head;
cout<<"{";
while(cur != NULL)
{
cout<<cur->getData()<<" ";
cur = cur->getNext();
}
cout<<"}";
}
void LinkedList::prepend(int list)
{
head = new Node(list, head);
}
void LinkedList::insert(int s)
{
if (head == NULL)
prepend(s);
else if (head->getData() <= s)
prepend(s);
else
{
Node* cur = head;
while(cur->getNext() != NULL && s < cur->getNext()->getData())
{
cur = cur->getNext();
cur->setNext(new Node(s, cur->getNext()));
}
}
}
|
And this is a different connected file:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
int Node::getData()
{
return data;
}
Node* Node::getNext()
{
return next;
}
void Node::setData(int item)
{
data = item;
}
void Node::setNext(Node* n)
{
next = n;
}
|
Any new eyes to this would be appreciated.. thank you
You are including the header for Node, right?
Yeah, I've included it in all my files.. :-/
Topic archived. No new replies allowed.