Error : unknown type name

I try to tutorial CERN ROOT by youtube video[video title is CERN ROOT tutorial for beginners - 3. Write a Tree with struct and class (example 4-5)], but it doesn`t worked.

here is my code

[code] void example5() {
TTree t(“t”,“a simple Tree with struct”)
gSystem->Load (“particle_CLASS_h.so”);
particle_CLASS* sParticle = new particle_CLASS();

t.Branch (“particle_info”, &sParticle);
sParticle->Set_energy(11);
sParticle->Set_position(1.1, 2.2, 3.3);
t.Fill();

sParticle->Set_energy(99);
sParticle->Set_position(191., 291., 391.);
t.Fill();

TFile f(“example5.root”,“recreate”);
t.Write();
f.Close();
} [/code]

and it is header code “particle_CLASS.h” using my main code.

[code]
class particle_CLASS: public TObject {
private:
Float_t position[3];
Float_t energy;
public:
particle_CLASS() { } // empty constructor
//----Setter----
void Set_position(Float_t x, Float_t y, Float_t z)
{
position[0] = x; position[1] = y; position[2] = z;
}

void Set_energy(Float_t e) { energy = e;}

//----Getter----
Float_t* Get_position() { return position; }
Float_t Get_energy() { return energy; }

ClassDef(particle_CLASS,1)
/*
| ClassDef is a C preprocessor macro
| that must be used if your class derives from TObject.
*/
};[/code]

input command [quote].x particle_CLASS.h++ [/quote] in root. then file ‘particle_CLASS_h.so’ created in same folder.

so…
how can i fix it?

Add #include "particle_CLASS.h" in your macro.

Cheers, Bertrand.

Thank you! So much!.
you save my life :slight_smile:

Best regard. Z