Usenet comp.unix.osf.osf1 (1992-2004)
 help / color / mirror / Atom feed
* Templates in digital C++
@ 1998-02-24  5:00 Chris Fury
  1998-03-11  5:00 ` Jeff Sullivan
  0 siblings, 1 reply; 2+ messages in thread
From: Chris Fury @ 1998-02-24  5:00 UTC (permalink / raw)



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 T> class TestTemplate {
	   public:
               TestTemplate(void);
	};

template.cc

	template<class T>
	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.



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1998-03-11  5:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-02-24  5:00 Templates in digital C++ Chris Fury
1998-03-11  5:00 ` Jeff Sullivan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox