Mail Archives: djgpp/1997/08/09/01:14:13
Stefan Schimanski (stefan DOT schimanski AT metronet DOT de) wrote:
: Hi,
: I've implemented the following template class, that simulates a dynamic
: array. Although I've put the whole definition of the class in the header
: file, the linker displays errors. The compiler works fine. The linker can't
: find the constructor definition:
: Error: contest.o: In function `global constructors keyed to C':
: contest.cc(24) Error: undefined reference to
: `CContainer<int>::CContainer(int)'
: There were some errors
: I've removed the parameter of the constructor an tried again. But I got the
: same error. I know that some parameter for gcc exist to control the way it
: handles template. Would some of them help?
May be, I didn't try for myself. The problem could be either that you omitted
the #pragma interface directive, or that you have to declare you implementations
as inline explicitely.
Try to write the implementation code inside the class definition.
BTW why are you defining a container class (if not for study purposes), use STL
components. These will be much more reliable than your own implementations and
provide a lot of standard container types.
I've not got it on my hand now, but if you're interested I can mail you where
to find good documentation on STL on request. The headers and implementations are
already part of the DJGPP standard C++ environment.
HTH
Guenther
- Raw text -