Hey guys I working on making a Deque, but right now I'm just trying to make one node with an integer value. The error I'm getting is:
(pa1 is the main class)
pa1.cpp: In function âint main()â:
pa1.cpp:12:17: error: no matching function for call to âDeque<int>::insertHead(int)â
pa1.cpp:12:17: note: candidate is:
Deque.h:39:12: note: Error_code Deque<T>::insertHead(T&) [with T = int]
Deque.h:39:12: note: no known conversion for argument 1 from âintâ to âint&â
I'm not sure what I'm doing wrong i have been stuck on this problem for hours and everything I try dosen't seem to fix it. Any help would be greatly appreciated.
Thanks guys that fixed the problem, but now I get the error:
/tmp/cc52HcBw.o: In function `main':
pa1.cpp:(.text+0x37): undefined reference to `Deque<int>::~Deque()'
pa1.cpp:(.text+0x52): undefined reference to `Deque<int>::~Deque()'
/tmp/cc52HcBw.o: In function `Deque<int>::insertHead(int const&)':
pa1.cpp:(.text._ZN5DequeIiE10insertHeadERKi[Deque<int>::insertHead(int const&)]+0x4e): undefined reference to `Node<int>::Node(int, Node<int>*, Node<int>*)'
collect2: ld returned 1 exit status
Thanks keskiverto completely forgot to do the implementation! Heres the new Deque, but I still get the error:
/tmp/cctYIBdh.o: In function `Deque<int>::insertHead(int const&)':
pa1.cpp:(.text._ZN5DequeIiE10insertHeadERKi[Deque<int>::insertHead(int const&)]+0x4e): undefined reference to `Node<int>::Node(int, Node<int>*, Node<int>*)'
collect2: ld returned 1 exit status
Undefined reference means your are referencing something that has been declared, but not defined. Just like you didn't actually write the code for the Deque destructor, you haven't actually written the code for the Node constructor.