Hi Heather, There were severals problems with the handling of templates (and with the handling of namespaces and nested classes). Those problems have been fixed in ROOT 3.03/09. Please upgrade and test again. Cheers, Philippe. -----Original Message----- From: owner-roottalk@pcroot.cern.ch [mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of Heather Kelly Sent: Thursday, October 10, 2002 9:52 AM To: roottalk@pcroot.cern.ch Subject: [ROOT] template class and VC++ 6 Hi, I am using ROOT 3.02.07 on both Windows and Linux. I was just trying to introduce a new template class, and I started to run into problems. I went back to the user's guide and decided to implement the simple example, where I just define a header file - in this case rather than MyClass1.h I call it Relation.h: #ifndef RELATION_H #define RELATION_H template <typename T> class Relation { private: T fA; public: Relation() {}; ~Relation() {}; ClassDefT(Relation,1) }; ClassDefT2(Relation,T) ClassImpT(Relation,T) #endif My LinkDef file is: #ifdef __CINT__ #pragma link off all globals; #pragma link off all classes; #pragma link off all functions; #pragma link C++ class Relation<int>+; #endif This compiles just fine on Linux using gcc 2.91. However, it fails on Visual C++ 6.0. I am not sure if this is a deficiency in the VC++ compiler or an error on my part. The first error message is: commonRootData_rootcint.cxx(17) : error C2143: syntax error : missing ';' before '<' Which refers to this line in the rootcint file: template <> TBuffer &operator>><int >(TBuffer &buf, Relation<int> *&obj) Any suggestions would be welcome. Thanks, Heather
This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:14 MET