M
Matt Williams
I'm coming from a Java background - trying to build a linked list in
C++. I've read up on and understand the differences btw. the two
languages when it comes to pointers and most of the basics. My linked
list consisting of a driver, linkedlist, and node class all compile
correctly, but I am getting 13 linking errors:
Linking...
ListDriver.obj : error LNK2005: "public: __thiscall Node::Node(int)"
(??0Node@@QAE@H@Z) already defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
Node::setNext(class Node *)" (?setNext@Node@@QAEXPAV1@@Z) already
defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
Node::setPrevious(class Node *)" (?setPrevious@Node@@QAEXPAV1@@Z)
already defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: class Node * __thiscall
Node::getNext(void)" (?getNext@Node@@QAEPAV1@XZ) already defined in
LinkedList.obj
ListDriver.obj : error LNK2005: "public: class Node * __thiscall
Node::getPrevious(void)" (?getPrevious@Node@@QAEPAV1@XZ) already
defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: int __thiscall
Node::getData(void)" (?getData@Node@@QAEHXZ) already defined in
LinkedList.obj
ListDriver.obj : error LNK2005: "public: __thiscall
LinkedList::LinkedList(void)" (??0LinkedList@@QAE@XZ) already defined
in LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
LinkedList::add(int)" (?add@LinkedList@@QAEXH@Z) already defined in
LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
LinkedList:rint(void)" (?print@LinkedList@@QAEXXZ) already defined
in LinkedList.obj
Node.obj : error LNK2005: "public: __thiscall Node::Node(int)"
(??0Node@@QAE@H@Z) already defined in LinkedList.obj
Node.obj : error LNK2005: "public: void __thiscall Node::setNext(class
Node *)" (?setNext@Node@@QAEXPAV1@@Z) already defined in
LinkedList.obj
Node.obj : error LNK2005: "public: void __thiscall
Node::setPrevious(class Node *)" (?setPrevious@Node@@QAEXPAV1@@Z)
already defined in LinkedList.obj
Node.obj : error LNK2005: "public: class Node * __thiscall
Node::getNext(void)" (?getNext@Node@@QAEPAV1@XZ) already defined in
LinkedList.obj
Node.obj : error LNK2005: "public: class Node * __thiscall
Node::getPrevious(void)" (?getPrevious@Node@@QAEPAV1@XZ) already
defined in LinkedList.obj
Node.obj : error LNK2005: "public: int __thiscall Node::getData(void)"
(?getData@Node@@QAEHXZ) already defined in LinkedList.obj
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/FirstProject.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Any help would be greatly appreciated..... thanks
C++. I've read up on and understand the differences btw. the two
languages when it comes to pointers and most of the basics. My linked
list consisting of a driver, linkedlist, and node class all compile
correctly, but I am getting 13 linking errors:
Linking...
ListDriver.obj : error LNK2005: "public: __thiscall Node::Node(int)"
(??0Node@@QAE@H@Z) already defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
Node::setNext(class Node *)" (?setNext@Node@@QAEXPAV1@@Z) already
defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
Node::setPrevious(class Node *)" (?setPrevious@Node@@QAEXPAV1@@Z)
already defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: class Node * __thiscall
Node::getNext(void)" (?getNext@Node@@QAEPAV1@XZ) already defined in
LinkedList.obj
ListDriver.obj : error LNK2005: "public: class Node * __thiscall
Node::getPrevious(void)" (?getPrevious@Node@@QAEPAV1@XZ) already
defined in LinkedList.obj
ListDriver.obj : error LNK2005: "public: int __thiscall
Node::getData(void)" (?getData@Node@@QAEHXZ) already defined in
LinkedList.obj
ListDriver.obj : error LNK2005: "public: __thiscall
LinkedList::LinkedList(void)" (??0LinkedList@@QAE@XZ) already defined
in LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
LinkedList::add(int)" (?add@LinkedList@@QAEXH@Z) already defined in
LinkedList.obj
ListDriver.obj : error LNK2005: "public: void __thiscall
LinkedList:rint(void)" (?print@LinkedList@@QAEXXZ) already defined
in LinkedList.obj
Node.obj : error LNK2005: "public: __thiscall Node::Node(int)"
(??0Node@@QAE@H@Z) already defined in LinkedList.obj
Node.obj : error LNK2005: "public: void __thiscall Node::setNext(class
Node *)" (?setNext@Node@@QAEXPAV1@@Z) already defined in
LinkedList.obj
Node.obj : error LNK2005: "public: void __thiscall
Node::setPrevious(class Node *)" (?setPrevious@Node@@QAEXPAV1@@Z)
already defined in LinkedList.obj
Node.obj : error LNK2005: "public: class Node * __thiscall
Node::getNext(void)" (?getNext@Node@@QAEPAV1@XZ) already defined in
LinkedList.obj
Node.obj : error LNK2005: "public: class Node * __thiscall
Node::getPrevious(void)" (?getPrevious@Node@@QAEPAV1@XZ) already
defined in LinkedList.obj
Node.obj : error LNK2005: "public: int __thiscall Node::getData(void)"
(?getData@Node@@QAEHXZ) already defined in LinkedList.obj
LIBCD.lib(crt0.obj) : error LNK2001: unresolved external symbol _main
Debug/FirstProject.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
Any help would be greatly appreciated..... thanks