链接错误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 包含在项目中。任何帮助将不胜感激。
so im getting this error
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
plus the same errors for each function I call that is in the linked list
I have 4 files. a linked_list.h, linked_list.cpp, stack_ll.h, stack_ll.cpp
Linked_list.h has the class definition. linked_list.cpp has all the functions of said class. stack_ll.h has another class for a stack that stores everything using the linked list. and finally stack_ll.cpp that has the functions for the stack plus main(). For some reason the linker is saying that none of the functions of the linked list class have been defined. linked_list.cpp is included in the project. Any help would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您尚未显示代码,但问题几乎可以肯定是您在 .cpp 文件而不是 .h 文件中定义了一些类模板成员函数。
请参阅 C++ 常见问题解答:如何避免链接器错误我的模板类?。
You haven't shown the code, but the problem is almost certainly that you've defined some class-template member functions in your .cpp file, rather than your .h file.
See the C++ FAQ: How can I avoid linker errors with my template classes?.