I can't compile my code in root v5.27

When i want to compile my code, it would show the following massage.

Info in TUnixSystem::ACLiC: creating shared library /home/cylin/mulife/./mulife_C.so
sh: g++34: command not found
Error: external preprocessing failed. :0:
!!!Removing /home/cylin/mulife/mulife_C_ACLiC_dict.cxx /home/cylin/mulife/mulife_C_ACLiC_dict.h !!!
Error: /home/cylin/root/bin/rootcint: error loading headers…
Error in : Dictionary generation failed!
Info in : Invoking compiler to check macro’s validity
sh: g++34: command not found

However, my code is pretty simple.

void mulife()
{
float i,j,k,a;
ifstream f;
c=new TCanvas(“c”,“muon lifetime”,200,10,700,500);
void mulife()
{
float i,j,k,a;
ifstream f;
c=new TCanvas(“c”,“muon lifetime”,200,10,700,500);
void mulife()
{
float i,j,k,a;
ifstream f;
c=new TCanvas(“c”,“muon lifetime”,200,10,700,500);
h=new TH1F(“h”,“muon life time”,30,0,19);
f.open("/home/cylin/mulife/mulife.txt",ios::in);
f>>i;

while (!f.eof())
{
printf("%2.3f\n",i);

h->Fill(i);
f>>i;

}
f.fclose;

TF1*t1=new TF1("t1","[0]*exp(-x/[1])",0,10);
t1->SetParNames("Particles","lifetime");
t1->SetParameters(200,300);
t1->SetParameter(1,2.5);
h->Fit("t1");
gStyle->SetOptFit(0001);

 h->Draw("E");

}

what should i do to fix the problem?

Hi,

[quote]sh: g++34: command not found[/quote]indicates that the compiler (g++34) used to compile your version of ROOT is not available in your PATH. Make sure to properly add the location of g++34 to your PATH variable.

If on your system, g++ v3.4 has a different (maybe just ‘g++’), you could modify the compilation line used by ACLiC with:TString cmd = gSystem->GetMakeSharedLib(); cmd.ReplaceAll("g++34","g++"); gSystem->SetMakeShreadLib(cmd);

Cheers,
Philippe.

Sorry, but i have no idea how to check the path and change the path for root to g++3.4.

And what should i do with the code you give? To add to my code?

[quote]Sorry, but i have no idea how to check the path and change the path for root to g++3.4.[/quote]You should contact your local system administration and/or the person that build the version of ROOT you are using.

[quote]And what should i do with the code you give? To add to my code?[/quote]Yes.

Philippe.

Philips:

Thanks for your answer. But in the condition, can i do something to check the problem is really due to path to g++3.4? Or can i do something to fix the problem by myself?

Hi,

On your machine do:locate g++34 g++ --version

Philippe.

Philips:

I tried the two command, and this is the massage it return to me:

[cylin@grid03 ~]$ locate g++34 <== it didn’t return me anything.
[cylin@grid03 ~]$ g++ --version
g++ (GCC) 4.1.2 20080704 (Red Hat 4.1.2-46)
Copyright © 2006 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Hi,

Your system does not (most likely) have the compiler version that was used to compile the version of ROOT you have downloaded/installed. You either need to install gcc v3.4. or you should download the ROOT source code and compile it yourself.

Cheers,
Philippe.