Hi,
I can successfully write objects of type WeightedLink to file ina program and read them out again in a CINT session.
I then try to make WeightedLink templated and adapt the LinkDef.h file accordingly. rootcint then stops with an error message:
Error: link requested for unknown class WeightedLink G__auto6316LinkDef.h
As you can see, the class has a default constructor. It is my understanding that putting the following statement in the LinkDef.h should make ROOT aware of the double version of the template code, but apparently it doesn't. Any suggestions as to what might be wrong?
#pragma link C++ class WeightedLink<double>+;
Thanks,
Marc
The original WeightedLink.h is:
class WeightedLink : public TNamed
{
public:
ClassDef(WeightedLink,1);
Id _id_from;
Id _id_to;
double _weight;
WeightedLink():_id_from(Id(0)),_id_to(Id(0)),_weight(0.0){}
WeightedLink
(
Id id_from, Id id_to, double weight ):
_id_from(id_from),
_id_to(id_to),
_weight(weight)
{ } }; typedef WeightedLink D_WeightedLink;
It is changed into:
template <class Weight>
class WeightedLink : public TNamed
{
public:
ClassDef(WeightedLink,1);
Id _id_from;
Id _id_to;
double _weight;
WeightedLink():_id_from(Id(0)),_id_to(Id(0)),_weight(0.0){}
WeightedLink
(
Id id_from, Id id_to, double weight ):
_id_from(id_from),
_id_to(id_to),
_weight(weight)
{ } }; typedef WeightedLink<double> D_WeightedLink;
The relevant entry in LinkDef.h is changed from
#pragma link C++ class WeightedLink<+;
into
#pragma link C++ class WeightedLink<double>+;
-
Dr. Marc de Kamps
Biosystems Group
School of Computing
University of Leeds
LS29JT, Leeds, UK
<mailto:dekamps_at_comp.leeds.ac.uk> dekamps_at_comp.leeds.ac.uk
http:/www.comp.leeds.ac.uk/dekamps Received on Mon Aug 18 2008 - 12:27:41 CEST
This archive was generated by hypermail 2.2.0 : Mon Aug 18 2008 - 23:50:01 CEST