From: "Rafal Maj (Raf256)" Newsgroups: comp.os.msdos.djgpp Subject: Templates Date: Mon, 9 Jul 2001 01:52:42 +0200 Organization: Academic Computer Center CYFRONET AGH Lines: 35 Message-ID: <9iarst$mm5$1@info.cyf-kr.edu.pl> NNTP-Posting-Host: d-94-53-14.cyfronet.krakow.pl X-Trace: info.cyf-kr.edu.pl 994636509 23237 149.156.1.174 (8 Jul 2001 23:55:09 GMT) X-Complaints-To: news AT cyf-kr DOT edu DOT pl NNTP-Posting-Date: Sun, 8 Jul 2001 23:55:09 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, I have class cTest, its definition is in one file and declaration in another ---test.h--- class cTest { public : void fun(); }; ---test.cc--- void cTest::fun() { } And this is ok, I can use it : ---main.cc--- #include "test.h" int main() { cTest t; t.fun(); return 0; } But after changing class to template I cant link program : ---test.h--- template class cTest { public : void fun(); }; ---test.cc--- template void cTest::fun() { } And this is ok, I can use it : ---main.cc--- #include "test.h" int main() { cTest t; t.fun(); return 0; } This generates error at link-time, that linker can't find body of void cTest::fun()... How to solve this problem ? I must use .cc + .h (not single .cc) because I want to use this template class in many parts of project... Thanks in advice :) -- Raf256