链接错误lnk2019

时间:2012-01-22 22:12:50

标签: c++ lnk2019

所以我得到这个错误

Error   1   error LNK2019: unresolved external symbol "public: enum LL_ERR __thiscall linkedList<int>::addData(int)" (?addData@?$linkedList@H@@QAE?AW4LL_ERR@@H@Z) referenced in function "public: enum S_ERROR __thiscall stack<int>::push(int const &)" (?push@?$stack@H@@QAE?AW4S_ERROR@@ABH@Z)  C:\Users\Spyder\Documents\Visual Studio 2010\Projects\stack_ll\stack_ll\stack__ll.obj   stack_ll

加上我在链接列表中调用的每个函数的相同错误

我有4个文件。一个linked_list.h,linked_list.cpp,stack_ll.h,stack_ll.cpp Linked_list.h具有类定义。 linked_list.cpp具有所述类的所有功能。 stack_ll.h有一个堆栈的另一个类,它使用链表存储所有内容。最后是stack_ll.cpp,它具有堆栈和main()的功能。由于某种原因,链接器说没有定义链表类的任何功能。 linked_list.cpp包含在项目中。任何帮助将不胜感激。

1 个答案:

答案 0 :(得分:3)

您还没有显示代码,但问题几乎可以肯定,您已经在.cpp文件中定义了一些类模板成员函数,而不是.h文件。

请参阅C ++常见问题解答:How can I avoid linker errors with my template classes?

相关问题