[C++]Class templates???

From: Bode, Wyatt (wjbode@BEMIS.COM)
Date: 08/28/97


Anyone know how to properly use class templates in C++?  I bought a book
on them this weekend, and was trying out one of the examples when MSVC
5.0 blew up.  I was modifying a linked-list class template, and this is
what I get when I make the project:

Linking...
main.obj : error LNK2001: unresolved external symbol "public: __thiscall
LinkedList<class CharString>::~LinkedList<class CharString>(void)"
(??1?$LinkedList@VCharString@@@@QAE@XZ)
main.obj : error LNK2001: unresolved external symbol "public: __thiscall
LinkedList<class CharString>::LinkedList<class CharString>(void)"
(??0?$LinkedList@VCharString@@@@QAE@XZ)
Debug/Test.exe : fatal error LNK1120: 2 unresolved externals

I get no compile errors, and this is my main function:

#include "list.h"

// a simple class to test the template...
class CharString {
        public:
                char text[256];

                inline CharString() { for (int i = 0; i < 256; i++)
text[i] = '\0'; }
                inline CharString(const char *msg) { strcpy(text, msg);
}
                inline ~CharString() { }
};

void main() {
        LinkedList<CharString> test;
}


Any ideas?  I looked up templates in the MSVC manual, but everything I
have looks right...  I would post the source code, but it's over 200
lines and not everyone likes SPAM... 8-|

        Thanks in advance,
        Wyatt


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST