From mboxrd@z Thu Jan 1 00:00:00 1970 From: Toshinao ISHII To: egcs@cygnus.com Subject: c++ template class problem Date: Wed, 23 Sep 1998 08:43:00 -0000 Message-id: <199809231033.TAA06844@rothko.qua.srl.melco.co.jp> X-SW-Source: 1998-09/msg01285.html 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<<(ostream &, C const &)' /ici/work/test_template/poi01.C:27: undefined reference to \ `ostream & operator<<(ostream &, C 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 const &" should be "const C &". 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