Hi Maurizio,
You have a C++ problem, not a CINT problem.
> char tit[100];
> TH1F* W[6];
This defines W as an array of 6 pointers to TH1F, which is what you
want.
> for(int i=0;i<6;++i)
> {
> sprintf(tit,"W%d",i);
> TH1F* W[i] = new TH1F(tit,tit,100,0.5,2.2);
This statement tries to redefine a new variable W (valid only inside
the loop but having the same name as the one you defined outside) as an
array of i pointers to TH1F. Arrays of variable bounds are not allowed
in C++ (in order to allow compilers to optimize); CINT allows it as an
extension, but only in interpreted mode.
Even if it did work, your initialization is not valid for an array of
pointers, only for one pointer. You might get a more meaningful error
message, though.
You probably meant:
W[i] = new TH1F(tit,tit,100,0.5,2.2);
which doesn't attempt to define any new variables, only use existing
ones.
Regards,
George Heintzelman
gah@bnl.gov
This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:30 MET