Error: redefinition of 'n'

Hello everyone,

When I run a script on a fresh installation of ROOT, I get the following error:

…and many similar others.

I know this is happening because I’m declaring the same variable more than once.

What I don’t understand is that in a previous (older) installation of ROOT this script was running fine.
Why is this happening? And is there a way to tell ROOT to ignore this, and other errors which are not appearing when I run the script in the other installation?

Hi,

Is this new installation a root6 version?

Danilo

Yes, version 6.04.

The interpreter of the 6 series is nased on clang and as such is as strict as a compiler when it comes to checks such as multiple definitions. It is requiring proper c++ also for macros.
It is not possible to turn off the errors you see, the only path is fixing the code. It will of course still be compatible with cint.

Danilo

1 Like

That’s a pity. I need to run the code only once, and it’s not worth in term of time to fix it.
I guess I’ll run it from another installation and be more careful in writing my code with v6.

Thank you for your answer!

In trying to fix it, I’m stucked with this error:

/home/sporzio/Dropbox/Paper/Proton/FitCosmicRays.C:177:11: error: cannot initialize a variable of type 'TGraph *' with an rvalue of type 'TObject *' TGraph *gr1 = gMinuit->Contour(10,0,3);

I’m not sure how to rewrite it to make it work.

TGraph *gr1 = ((TGraph *)(gMinuit->Contour(10,0,3)));

It works, thanks!