Mail Archives: djgpp/1999/09/23/21:25:13
> I think that I have a problem related to template instantiation,
> the following code :
>
> // FILE rwfile.h and rwfile.cpp
> #include "smat.h"
>
> class rwfile
> {
> ..
> template <class T> int read( smat<T> data);
> ..
> }
> compiles without problems, but the linker reports (I am using a RHIDE
> 1.4.7 project):
>
> Error undefined reference to int rwfile::read( smat<int> )
>
> any ideas?
Yes, you probably wanted to define read() in the header file rwfile.h
template <class T> int rwfile::read(smat<T> data)
{
// ...
}
Rather than in rwfile.cpp where I assume that you defined it.
OTOH, if you have found a bug in gcc then it is better to reduce the
program to the minimum that causes the error then cut and paste that
verbatim, else it just leaves everybody guessing. :)
--
george
- Raw text -