Me again! This time adding to the linked list
Creating the function to add to the end of the list now, here's the code:
Code:
void CList::add(CNode *pRoot, std::string input) // function to add a new node at the end
{
CNode *pPointer;
pPointer = pRoot;
if(pPointer != 0)
{
while(pPointer->pNext != 0)
{
pPointer = pPointer->pNext;
}
}
pPointer->pNext = new CNode;
pPointer = pPointer->pNext;
pPointer->pNext = 0;
pPointer->name = input;
}
Now i'm pretty proud of that, as it's the best looking code i've probably ever written, lol, except that i get some weird error:
CList.obj : error LNK2019: unresolved external symbol "public: __thiscall CNode::CNode(void)" (??0CNode@@QAE@XZ) referenced in function "public: void __thiscall CList::add(class CNode *,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> >)" (?add@CList@@QAEXPAVCNode@@V?$basic_string@DU?$cha r_traits@D@std@@V?$allocator@D@2@@std@@@Z)
Debug\Linked List.exe : fatal error LNK1120: 1 unresolved externals
It looks to me as if it should work fine, but as usual i'm completely baffled, and im asking you guys on here to help me, hehe, thanks a million
P.S. do you need the header files code? the prototypes match so i dont see how it's anything to do with them