RE: [ROOT] Problem with rootcint (ClassDef issue)

From: Philippe Canal (pcanal@fnal.gov)
Date: Fri Jul 26 2002 - 20:16:49 MEST


Hi Giuseppe,

You have declared the class secondaclass in BOTH the header file and the
implementation file.  You should eliminate the declaration from the
implementation file (In addition the 2 declaration to no agree, one has a
ClassDef the other does not).

Thirdly, until tomorrow or the day after (yes really :) ), You can NOT had a
semi-colon (';') after the ClassDef macro.  I.e you have to use:

     void print();
     ClassDef(secondaclasse,1)
  };

In the next day or so, we will update the ROOT cvs repository so that one
can add the semi-colon after ClassDef.  The update will also allow ClassDef
to be parsed by the interpreted.  The down-side is for developers who wrote
their own custom ClassDef, those (if any) would need to mirror our changes.

Cheers,
Philippe.

-----Original Message-----
From: owner-roottalk@pcroot.cern.ch
[mailto:owner-roottalk@pcroot.cern.ch]On Behalf Of
giuseppe.foggi@libero.it
Sent: Friday, July 26, 2002 11:42 AM
To: roottalk@pcroot.cern.ch
Subject: [ROOT] Problem with rootcint


Hi ROOTers,

I have some problems.
I wrote a simple class:

#include <iostream.h>
#include "TObject.h"
#include "secondaclasse.h"

ClassImp(secondaclasse); // Seconda classe

  class secondaclasse : public TObject
{

  private:
      int x,y;
  public:
     secondaclasse();
     void setx(int xx);
     void sety(int yy);
     void print();

};

secondaclasse::secondaclasse()
{
  x=0;
  y=0;
}

void secondaclasse::setx(int xx)
{
  x=xx;
}

void secondaclasse::sety(int yy)
{
  y=yy;
}

void secondaclasse::print()
{
  cout<<"\nX= "<<x<<"\tY= "<<y<<endl;
}


and the class header is
#include <iostream.h>
#include "TObject.h"


class secondaclasse : public TObject
{

  private:
      int x,y;
  public:
     secondaclasse();
     void setx(int xx);
     void sety(int yy);
     void print();
     ClassDef(secondaclasse,1);
};

When I write
	rootcint dict.cxx -c secondaclasse.h LinkDef.h
I get:
	Class secondaclasse: Streamer() not declared
	Class secondaclasse: ShowMembers() not declared
Why?
My LinkDef.h is

#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ class secondaclasse+;

#endif

After, I write:
	g++ -fPIC -I $ROOTSYS/include dict.cxx
and I get several errors, for example
dict.cxx: In function `int G__secondaclasse_ClassDef_4_0 (G__value *,
const char *, G__param *, int)':
dict.cxx:104: parse error before `private'
dict.cxx:104: cannot declare static function inside another function
dict.cxx:104: cannot declare static function inside another function
dict.cxx:104: parse error before `{'
dict.cxx:104: warning: no return statement in function returning
non-void
...........
Why?
Thank you for your help.
Giuseppe.

My system is Linux Red Hat 7.1
ROOT version is : ROOT 3.02/07



This archive was generated by hypermail 2b29 : Sat Jan 04 2003 - 23:51:01 MET