templating a linked list
I have a doubly linked list class (and a node class). I've tested both their functions in main() and everything works the way it should.
However, I'm now trying to template both classes and I'm having problems. I've read tutorials and spent a few days on this yet I can't seem to get it right. If someone could look over my code I would really appreciate it!
the error i'm getting right now is in main.cpp when i create a DLList object for testing.
main.cpp|43|undefined reference to DLList<int>::DLList()
i've also tried DLList<DLNode> testList. I guess I'm not sure which to use (neither work though)
You can't separate templates into header and implementation. Templates have to be fully available when instantiated (all in a header).
so everything in DLList.cpp needs to be in DLList.h?
Or you can keep it where it is and include "DLList.cpp" from the end of the header. (You shouldn't compile the file separately, though, and commonly it is given a different extension like "tpp" or "inl").
wow thanks guys. everything works now WOW lol... spent so much time on this.
in my text book everything is seperated so that's why I did it that way. There's no include in the text book example though, but looking over it again there is a "usining namespace ..." in the cpp. Same effect?