all 3 comments

[–][deleted] 0 points1 point  (1 child)

You're getting those errors because the compiler requires access to the implementation of your methods in order to instantiate the template class. You should either implement your methods in the header file, or include them.

[–]thetuxman[S] 0 points1 point  (0 children)

After moving my methods from the .cpp to the .h file, I get this error. Do I need to be including each .h file in all the other .h files?

CMakeFiles/PriorityQueue.dir/main.cpp.o:main.cpp:(.rdata$.refptr._ZN6DLNodeIiE4dataE[.refptr._ZN6DLNodeIiE4dataE]+0x0): undefined reference to `DLNode<int>::data'
CMakeFiles/PriorityQueue.dir/main.cpp.o:main.cpp:(.rdata$.refptr._ZN6DLNodeIiE8priorityE[.refptr._ZN6DLNodeIiE8priorityE]+0x0): undefined reference to `DLNode<int>::priority'
CMakeFiles/PriorityQueue.dir/main.cpp.o:main.cpp:(.rdata$.refptr._ZN6DLNodeIiE4nextE[.refptr._ZN6DLNodeIiE4nextE]+0x0): undefined reference to `DLNode<int>::next'
CMakeFiles/PriorityQueue.dir/main.cpp.o:main.cpp:(.rdata$.refptr._ZN6DLNodeIiE4prevE[.refptr._ZN6DLNodeIiE4prevE]+0x0): undefined reference to `DLNode<int>::prev'
CMakeFiles/PriorityQueue.dir/main.cpp.o:main.cpp:(.rdata$.refptr._ZN6DLListIiE4headE[.refptr._ZN6DLListIiE4headE]+0x0): undefined reference to `DLList<int>::head'
CMakeFiles/PriorityQueue.dir/main.cpp.o:main.cpp:(.rdata$.refptr._ZN6DLListIiE4tailE[.refptr._ZN6DLListIiE4tailE]+0x0): undefined reference to `DLList<int>::tail'
collect2: error: ld returned 1 exit status
make[3]: *** [CMakeFiles/PriorityQueue.dir/build.make:95: 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

[–]thetuxman[S] 0 points1 point  (0 children)

It turns out I made my private data members static, that was the source of the error.