Re: rootcint problem

From: Fons Rademakers (Fons.Rademakers@cern.ch)
Date: Mon Feb 09 1998 - 19:25:56 MET


Hi Reiner,

   since recently (last two releases) the copy ctor of the
TCollection base class has been made private. This to prevent
unexpected behaviour in case people pass (by accident or ignorance)
a collection by value or embed them in classes without implementing
a proper copy ctor. What happens in the case below is that rootcint
generates always a default copy ctor in case there is not one
defined in the class. A default copy ctor tries to call the copy
ctor of all embedded objects, so also of the TList. However, the TList
has no public copy ctor so you get a compile error. To prevent
this just add a empty copy ctor to the class (so rootcint will
not generate one) and things work fine. See below for the one line
change.

Empty copy ctor:

private:
   MultiLineGraph(const MultiLineGraph &);

to prevent people from accidentally using it, omit the implementation
and you will get a link error.


Cheers, Fons.



ROHLFS Reiner wrote:
> 
> Hi Rooters,
> 
> please have a look to these files:
> 
> MultiLineGraph.h:
> ------------------------------------------------
> #include "TGraph.h"
> #include "TList.h"
> 
> class MultiLineGraph : public TGraph
> {
>         ClassDef(MultiLineGraph, 1)
>         TList           m_lineDesList;
> };
> ------------------------------------------------
> 
> and MLGLinkDef.h
> ------------------------------------------------
> #ifdef __CINT__
> 
> #pragma link off all globals;
> #pragma link off all classes;
> #pragma link off all functions;
> 
> #pragma link C++ class    MultiLineGraph;
> 
> #endif
> ------------------------------------------------
> 
> I create the file mgl_lib.cpp with this command:
> rootcint -f mgl_lib.cpp -c MultiLineGraph.h MLGLinkDef.h
> 
> and now I try to compile it with this command:
> CC -g  -I/isdc/software/root/include -c mgl_lib.cpp
> 
> But I get this error message:
> "mgl_lib.cpp", line 94: Error: TCollection::TCollection(const TCollection&) is
> not accessible from TSeqCollection::TSeqCollection(TSeqCollection&).
> 1 Error(s) detected.
> *** Error code 1
> make: Fatal error: Command failed for target `mgl_lib.o'
> Exit 1
> 
> With Version Sun/Solaris for SPARC 1.03/07 everything worked fine. But with
> version 1.03/09 I'm not able to compile this file.
> 
> Cheers Reiner.

-- 
Org:    CERN, European Laboratory for Particle Physics.
Mail:   1211 Geneve 23, Switzerland          Phone: +41 22 7679248
E-Mail: Fons.Rademakers@cern.ch              Fax:   +41 22 7677910



This archive was generated by hypermail 2b29 : Tue Jan 04 2000 - 00:34:29 MET