From: Chris Fury <cfury@bev.net>
Subject: Templates in digital C++
Date: 1998/02/24 [thread overview]
Message-ID: <34F2D7A3.41C6@bev.net> (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.
next reply other threads:[~1998-02-24 5:00 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
1998-02-24 5:00 Chris Fury [this message]
1998-03-11 5:00 ` Templates in digital C++ Jeff Sullivan
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox