问题遇到的现象和发生背景
在vs2013在做一个通用链表的析构函数发生报错,在网上查询一直无法解决。
问题相关代码,请勿粘贴截图
~List()
{
ListNode* p = Head->next;
delete p;
while (p != NULL)
{
Head->next = p->next;
delete p;
p = Head->next;
}
delete Head;
Head = Tail = NULL;
}
运行结果及报错内容
错误 1 error LNK2019: 无法解析的外部符号 "public: __thiscall ListNode::~ListNode(void)" (??1ListNode@@QAE@XZ),该符号在函数 "public: void * __thiscall ListNode::`scalar deleting destructor'(unsigned int)" (??_GListNode@@QAEPAXI@Z) 中被引用 C:\Users\86166\Documents\Visual Studio 2013\Projects\2022220\1通用链表\ConsoleApplication34\源.obj ConsoleApplication34