Re: [ROOT] TProfile as a member refuses to be declared

From: Jiri Masik (Jiri.Masik@cern.ch)
Date: Tue Jul 16 2002 - 15:07:02 MEST


Mathieu.Segaud@Crans.org (Mathieu SEGAUD) writes:

> Hello Rooters,
> 
> I'm trying to build a new class.
> Here is the header of my new class (msg.h)
> 
> #ifndef msg_h
> #define msg_h
> #include <TProfile.h>
> #include <TROOT.h>
> 
> 
> class msgclass{
> 
> public:
>  int ncrys;
>  int crismin;
>  int crismax;
> 
>  TProfile *profcrys;
> 
> 
> 
>     msgclass( int, int );
>  ~msgclass();
>  void Display( double, double, int );
>     void InitProfcrys(  int , char[80] );
>  ClassDef( msgclass , 1 )
> };
> 
> 
> #endif
> 
> InitProfcrys method is to initialize profcrys; here is its implementation in
> msg.cxx:
> 
> void InitProfcrys( int icris, char title[80] ){
>  profcrys = new TProfile( title , title , 200 , 0. , 20. );
> }
> 
> I have no problem with ClassImp or ClassDef but at compilation I get the
> message:
> 
>   msg.cxx(202) : error C2065: 'profcrys' : undeclared           identifier
> 
> I verified that all calls to TProfile.h and msg.h are done
> and I can't identify the cause of the problem
> 
> (I'm using version  3.02/07  of root)
> 
> thanks for any kind of help
> 
> Mathieu SEGAUD
> 
> ps: I can't figure out where the problem is, it seems in my opinion, to fit 
> to all basic rules of classes in C++....

Hi Mathieu,

your definition of method InitProfcrys is missing a scope operator.
it should read 
void msgclass::InitProfcrys( int icris, char title[80] ){
cheers
-- 
	Jiri



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