Problem with dictionary file

Hi,
I am writing a c++ program using the Event example given in the test folder. The class header file looks like

class Track;
class Event;
class Event : public TObject {
private:
int ENumber;
int RMode; //event type
int fNtrack; //Total Number of tracks
int fNtrack0; // number of final state tracks (after interaction)
int fNtrack1; // number of intial state tracks
int fNtrack3; // nnumber of intermediate state tracks
TRef fLastTrack; //reference pointer to last track
TClonesArray *fTracks; //->array with all tracks
static TClonesArray *fgTracks;
float Vx,Vy,Vz,Vt;
float Info1,Info2;
float NFlux;
public:
Event();
virtual ~Event();
Track *AddTrack(Float_t random, Float_t ptmin=1);
ClassDef(Event,1) //Event structure
};
I have generated the dictionary file eventdict.cxx for this class. I have added the line ClassImp(Event) in my class implementation file. The method AddTrack looks like:
Track * Event::AddTrack(Float_t random, Float_t ptmin)
{
// Add a new track to the list of tracks for this event.
TClonesArray &tracks = *fTracks;
Track *track = new(tracks[fNtrack++]) Track(random);
//Save reference to last Track in the collection of Tracks
fLastTrack = track;
return track;
}

But when I compile I get this error
:eventdict.o(.text+0x554): In function G__eventdict_152_0_2': /home/NuIno/eventdict.cxx:263: undefined reference toEvent::AddTrack(float, float)'
I dont get any error if remove the method from the class.
Can somebody help?
Thanks…
dsmcc

Hi,

Did you compile and link the source file that contain the implementation of Event::AddTrack? [If you did, please provide a complete example reproducing the problem].

Cheers,
Philippe.

Hi,
yes I did… and I sorted out the problem. I changed the order of ClassImp in the implementation file.
Previously it was:

ClassImp(Event);
ClassImp(Track);

Now changed it to
ClassImp(Track);
ClassImp(Event);

and now it works.
Thanks for your reply…
dsmcc