0

After compiling, I receive this error in terminal upon execution:

Undefined symbols for architecture x86_64:
  "DoubleLinkedList<int>::insertBack(int)", referenced from:
      Queue::enqueue(int) in Queue-ccbd45.o
  "DoubleLinkedList<int>::removeFront()", referenced from:
      Queue::dequeue() in Queue-ccbd45.o
  "DoubleLinkedList<int>::peek()", referenced from:
      Queue::peek() in Queue-ccbd45.o
  "DoubleLinkedList<int>::DoubleLinkedList()", referenced from:
      Queue::Queue() in Queue-ccbd45.o
  "DoubleLinkedList<int>::~DoubleLinkedList()", referenced from:
      Queue::~Queue() in Queue-ccbd45.o
ld: symbol(s) not found for architecture x86_64

I have scoured the web for solutions, and none have worked yet.

To my understanding, either the signature declaration does not match the signature definition, or I am not linking to the library correctly.

My Queue source code is simple:

Queue::Queue() {

}

Queue::~Queue() {

}


void Queue::enqueue(int data) {

    myDLL.insertBack(data);
}


int Queue::dequeue() {

    return myDLL.removeFront();
}


int Queue::peek() {

    return myDLL.peek();
}

Where myDLL is an instance of a DoubleLinkedList in the Queue class.

My DoubleLinkedList class is a template class using T, so in my main I build the queue using this:

DoubleLinkedList<int> myDLL;
  • Maybe you implemented your template in a `.cpp` file instead of a header. – drescherjm Mar 30 '18 at 02:39
  • 1
    Possible duplicate of [What is an undefined reference/unresolved external symbol error and how do I fix it?](https://stackoverflow.com/questions/12573816/what-is-an-undefined-reference-unresolved-external-symbol-error-and-how-do-i-fix) – 1201ProgramAlarm Mar 30 '18 at 04:14

0 Answers0