Hi Chris, In principle, interpreted classes cannot derive from a compiled class. In practice, it works, if you do not redefine virtaul functions of the base class. In your case, you still have a few C++ errors. If you are new to C++, I suggest the use of ACLIC to spot the C++ compiler errors. Do: root > .L Chanber.cxx+ root > Chamber c root > c.Dump() Rene Brun Chris Hayward wrote: > > Hi Rene, > Thanks for the help. I guess I've been using IDL for too long. I've fixed > the array initializations, but I am still having problems. I've tried to > follow the Event.h example. When I type > #include "Chamber.h" > there is only the following warning: > Warning: Interpreted class Chamber derived from precompiled class TObject > FILE:Chamber.h LINE:7 > !!!There are some limitations regarding compiled/interpreted class > inheritance > > When I try to define a Chamber object, ROOT crashes and I get the lxplus > command line. There are no error messages. I have tried to generate the > dictionary by the command: > rootcint ChamberDict.cxx Chamber.h+ > This seems to have worked, so I am not sure if I have left something out, > declared my class wrong, or made some other error. The Chamber.h and > Chamber.cxx files are attached below. > > Thank you for your help, > Chris > > Chamber.h: > > #include <iostream.h> > #include "TObject.h" > #include <string.h> > > class TDirectory; //I've added this because it was in Event.h; is it > //necessary? > > class Chamber : public TObject { > > public: > > const int maxscans=20; //const to determine array size > > char chamber_type[10]; //this info read from scan filenames > char site[6]; > int serial_no; > char section[maxscans]; //array of maxscans strings to allow for > maxscans > char orientation[maxscans]; > int scan_no[maxscans]; > > int ch_sag_1; //sag of chamber, wires, and difference for section > 1 > int wire_sag_1; > int sag_diff_1; > > int ch_sag_2; //sag of chamber, wires, and difference for section > 2 > int wire_sag_2; > int sag_diff_2; > > int tool[maxscans]; //data to be read from each scan > int side[maxscans]; > > int theta_x[maxscans]; > int S_z[maxscans]; > int S_y_corrected[maxscans]; > int S_y_raw[maxscans]; > int S_y_correction[maxscans]; > float rms[maxscans]; > > Chamber(); > > ClassDef (Chamber, 1); > }; > > Chamber.cxx: > > #include "Chamber.h" > ClassImp (Chamber); > > Chamber::Chamber() > { > chamber_type[0]=site[0]='\0'; > section[0]=orientation[0]='\0'; > > serial_no=ch_sag_1=wire_sag_1=sag_diff_1=ch_sag_2=wire_sag_2=sag_diff_2=0; > for (int i=0; i < maxscans; i++) { > scan_no[i]=tool[i]=side[i]=theta_x[i]=S_z[i]= > S_y_corrected[i]=S_y_raw[i]=S_y_correction[i]=0; > rms[i]=0.0; > }; > } #include "TObject.h" class Chamber : public TObject { public: char chamber_type[10]; //this info read from scan filenames char site[6]; Int_t serial_no; char section[20]; //array of 20 strings to allow for 20 scans char orientation[20]; Int_t scan_no[20]; Int_t ch_sag_1; //sag of chamber, wires, and difference for section 1 Int_t wire_sag_1; Int_t sag_diff_1; Int_t ch_sag_2; //sag of chamber, wires, and difference for section 2 Int_t wire_sag_2; Int_t sag_diff_2; Int_t tool[20]; //data to be read from each scan Int_t side[20]; Int_t theta_x[20]; Int_t S_z[20]; Int_t S_y_corrected[20]; Int_t S_y_raw[20]; Int_t S_y_correction[20]; Float_t rms[20]; Chamber(){ chamber_type[0]=site[0]=0; section[0]=orientation[0]=0; serial_no=ch_sag_1=wire_sag_1=sag_diff_1=ch_sag_2=wire_sag_2=sag_diff_2=0; for (int i=0;i<20;i++) { scan_no[i]=tool[i]=side[i]=theta_x[i]=S_z[i]=S_y_corrected[i]=S_y_raw[i]=S_y_correction[i]=0; rms[i]=0.0; } }; ClassDef (Chamber, 1); };
This archive was generated by hypermail 2b29 : Thu Jan 01 2004 - 17:50:12 MET