c++ template class problem
Toshinao ISHII
ici@qua.crl.melco.co.jp
Wed Sep 23 08:43:00 GMT 1998
Hi. I have just started using template in g++.
I tried compiling the following C++ source using template.
g++ (egcs-2.92.07) give the following error.
g++ -c poi01.C -g -frepo
g++ -o poi01 poi01.o
poi01.o: In function `main':
/ici/work/test_template/poi01.C:27: undefined reference to \
`ostream & operator<<<double>(ostream &, C<double> const &)'
/ici/work/test_template/poi01.C:27: undefined reference to \
`ostream & operator<<<double>(ostream &, C<double> const &)'
collect2: ld returned 1 exit status
gmake: *** [poi01] Error 1
It look g++ fail to instantiate the template function. In addition,
the second parameter "C<double> const &" should be
"const C<double> &".
Please let me know how to implement the template function.
Thanks in advance.
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
$B@P0f=SD>(B Toshinao Ishii
Advanced Technology R&D Center (ATC) $B;0I)EE5!(B($B3t(B)
Mitsubishi Electric Corporation $B@hC
More information about the Gcc
mailing list