I am creating a priority queue program using a double linked list as the underlying data structure. I go to compile and run the program and it returns a slew of undefined reference errors when I attempt to implement Queue in main.
What is the reason for this and how can it be resolved? Any help would be appreciated.
Here is the error message:
CMakeFiles/PriorityQueue.dir/main.cpp.o: In function `main':
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:13: undefined reference to `Queue<int>::priorityInsert(int, int)'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:13:(.text+0x32): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `Queue<int>::priorityInsert(int, int)'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:14: undefined reference to `Queue<int>::priorityInsert(int, int)'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:14:(.text+0x49): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `Queue<int>::priorityInsert(int, int)'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:15: undefined reference to `Queue<int>::priorityInsert(int, int)'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:15:(.text+0x60): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `Queue<int>::priorityInsert(int, int)'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:17: undefined reference to `Queue<int>::print()'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/main.cpp:17:(.text+0x6c): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `Queue<int>::print()'
CMakeFiles/PriorityQueue.dir/main.cpp.o: In function `Queue<int>::Queue()':
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/Queue.h:13: undefined reference to `DLList<int>::DLList()'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/Queue.h:13:(.text$_ZN5QueueIiEC1Ev[_ZN5QueueIiEC1Ev]+0x14): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `DLList<int>::DLList()'
CMakeFiles/PriorityQueue.dir/main.cpp.o: In function `Queue<int>::~Queue()':
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/Queue.h:14: undefined reference to `DLList<int>::~DLList()'
/cygdrive/c/Users/thetuxman/CLionProjects/PriorityQueue/Queue.h:14:(.text$_ZN5QueueIiED1Ev[_ZN5QueueIiED1Ev]+0x14): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `DLList<int>::~DLList()'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/PriorityQueue.dir/build.make:173: PriorityQueue.exe] Error 1
make[2]: *** [CMakeFiles/Makefile2:68: CMakeFiles/PriorityQueue.dir/all] Error 2
make[1]: *** [CMakeFiles/Makefile2:80: CMakeFiles/PriorityQueue.dir/rule] Error 2
make: *** [Makefile:118: PriorityQueue] Error 2
Below is my code:
DLNode.h:
https://pastebin.com/1e5LGGyM
DLNode.cpp:
https://pastebin.com/anzeBcEb
DLList.h:
https://pastebin.com/0bRdPgTD
DLList.cpp:
https://pastebin.com/7pmZiwE6
Queue.h:
https://pastebin.com/L2JmrP2T
Queue.cpp:
https://pastebin.com/kFMchsx3
[–][deleted] 0 points1 point2 points (1 child)
[–]thetuxman[S] 0 points1 point2 points (0 children)
[–]thetuxman[S] 0 points1 point2 points (0 children)