Re: [ROOT] Problems with TString and TMatrix in class member functions

From: cstrato@EUnet.at
Date: Thu Jan 04 2001 - 18:26:35 MET


Dear Rene

Thank you very much for this fast reply. This is really great.

Best regards
Christian Stratowa

Rene Brun wrote:

> Hi Christian,
>
> On Thu, 4 Jan 2001 cstrato@EUnet.at wrote:
>
> > Dear Rene
> >
> > Thank you very much for answering my questions. Since you said, you do not
> > understand my second question regarding TMatrix without having a working example,
> > I have implemented a "TestClass" which I compile as library "TestClass.so"
> > and use in macro "MacroTestClass.C.
> > Below I have attached all necessary files.
> >
> > When I write a simple macro (see TestMacro.C below), all works fine, but
> > when I put the same code in a member function I cannot compile the library.
> > However, when I put TMatrix on the stack and comment out the TString code,
> > everything works fine.
> >
> > I have the following questions:
> >
> > 1, Why can I not use vMatrix(i,j) when TMatrix is created on the heap?
> >    I get the following error when compiling TestClass:
>
> That is the way the operator () is defined. Do:
>    TMatrix *vM = new TMatrix(vNRows,vNCols);
>    TMatrix &vMatrix = *vM;
>
> >
> > [christian@cookiebook rootcode]$ gmake -f Makefile4TestClass
> > g++ -O -Wall -fPIC -fsigned-char -I/usr/X11/include -I/opt/root/include -c TestClass.cxx
> > TestClass.cxx: In method `void TestClass::FTest2(int, int)':
> > TestClass.cxx:59: `vMatrix' cannot be used as a function
> > TestClass.cxx:62: `vMatrix' cannot be used as a function
> > TestClass.cxx:63: `vMatrix' cannot be used as a function
> > gmake: *** [TestClass.o] Error 1
> >
> > 2, Why can I not append a number to TString?
> >    I get the following error when compiling TestClass:
> >
>
> This problem was fixed in TString two weeks ago. You can import the
> current CVS version.
>
> Rene Brun
>
> > [christian@cookiebook rootcode]$ gmake -f
> Makefile4TestClass
> > g++ -O -Wall -fPIC -fsigned-char -I/usr/X11/include -I/opt/root/include -c TestClass.cxx
> > TestClass.cxx: In method `void TestClass::FTest1(const char *)':
> > TestClass.cxx:40: ambiguous overload for `TString & += Int_t &'
> > /opt/root/include/TString.h:384: candidates are: class TString & TString::operator +=(const
> > TString &)
> > /opt/root/include/TString.h:387:                 class TString & TString::operator +=(char)
> >
> > /opt/root/include/TString.h:390:                 class TString & TString::operator +=(long
> > int)
> > /opt/root/include/TString.h:393:                 class TString & TString::operator +=(long
> > unsigned int)
> > gmake: *** [TestClass.o] Error 1
> >
> > Thank you once again for your help.
> >
> > Best regards
> > Christian Stratowa
> > Vienna, Austria
> >



This archive was generated by hypermail 2b29 : Tue Jan 01 2002 - 17:50:33 MET