‘Pi’ is not a member of ‘TMath’?

I am trying to run an old macro that works fine on my old system (Fedora 8 with ROOT_v5.14 installed).

Now I am using ROOT_V5.22 in Fedora 10 with gcc v.4.3.2 and I could not compile this macro. When I type in:

root [0] .L myMacro.C+

it says

error: ‘Pi’ is not a member of ‘TMath’

the line where has this problem looks like this:

numberOfRows = (Int_t) (2*TMath::Pi()*radius / padSize);

It’s rather strange because in ROOT when I type in

root [0] TMath::Pi()
(Double_t)3.14159265358979312e+00

it seems correct here. Then why there is problem when it is in a macro?

Thanks!

Pang

Hi,

We are improved the header file by removing the irrelevant dependencies. A side effect is that some code (like yours) that is (unwittingly) relying on those dependencies no longer compile and simply need to be updated to include the correct headers. In you case add#include "TMath.h"

Cheers,
Philippe.

1 Like

Thank you, Philippe! That solved my problem.

Pang