From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,8233e35633ca7b88,start X-Google-Attributes: gidfee84,public From: Chris Fury Subject: Templates in digital C++ Date: 1998/02/24 Message-ID: <34F2D7A3.41C6@bev.net>#1/1 X-Deja-AN: 328180397 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Organization: AeroSoft Newsgroups: comp.unix.osf.osf1 Eeek. I can't figure out why my code isn't compiling right in digital C++. It works fine in every other compiler I try it with (sgi, g++) Here's my setup... I have a directory structure (I don't know if this important for the c++ repository stuff) like this / (this is the root directory for my source tree) /Makefile.def - a gnu makefile that defines my platform types, etc. /Makefile /src /source1 /source2 - these are my source dirs Now, I create a class that's a template in one of my source dirs template.hh template class TestTemplate { public: TestTemplate(void); }; template.cc template TestTemplate::TestTemplate(void) { cout << "pppphhhhhppppt" << endl; } If I try to make this (with some reference to it in another file, of course), it won't compile, I get a linker error telling me it can't find the function definition. If I try to use the -ptr CC option to make ONE cxx_repository it doesn't seem to work. If I put the function definition right in the .hh file, or if I make all the functions in the class inline it does work. But this isn't acceptable. I have virtual functions in my templates, and I have to define the virtual functions INSIDE the class definition for it to compile and recognize it. Ack. I guess what I'm trying to ask here is how do templates work in digital C++? What kind of voodoo do I need to do to make them work for me? I know this example is probably confusing... Email me and I'll try to clear it up. -- Short, simple, consise, haiku is easy to write. Write me one, for fun.