TMath::Limits not found

hi all

i have a code that gives errors when i compile in g++ like :

 error: ‘Limits’ is not a member of ‘TMath’
 error: expected primary-expression before ‘>’ token
 error: ‘::Max’ has not been declared

and gives error in ROOT like

Error: Symbol Limits is not defined in current scope  PropagatorGeom.C:845:
Error: Symbol double is not defined in current scope  PropagatorGeom.C:845:

The relevant lines in code are :

lengths[itrack]=TMath::Limits<double>::Max();

is this a deprecated function ? if yes what would be the appropriate substitute ?

thanks

Hi,

This is quite new function, introduced in the latest release, 5.30. If you are using an older version they are not there. You can use std::numeric_limits
Best Regards,
Lorenzo

thanks , i built v5.30.1 and the error is gone, so now its working fine when i run it in root, but when i try to compile using g++ i get errors. i think i am missing a library, but i dont know which one. please have a look :

g++ `root-config --cflags --evelibs` PropagatorGeomCXX.cxx /tmp/ccrBVE4S.o: In function `__static_initialization_and_destruction_0(int, int)': PropagatorGeomCXX.cxx:(.text+0x7796): undefined reference to `ROOT::GenerateInitInstance(GeantOutput const*)' PropagatorGeomCXX.cxx:(.text+0x77b8): undefined reference to `ROOT::GenerateInitInstance(GeantVolumeBasket const*)' /tmp/ccrBVE4S.o: In function `GeantVolumeBasket::IsA() const': PropagatorGeomCXX.cxx:(.text._ZNK17GeantVolumeBasket3IsAEv[GeantVolumeBasket::IsA() const]+0xd): undefined reference to `GeantVolumeBasket::Class()' /tmp/ccrBVE4S.o: In function `GeantOutput::IsA() const': PropagatorGeomCXX.cxx:(.text._ZNK11GeantOutput3IsAEv[GeantOutput::IsA() const]+0xd): undefined reference to `GeantOutput::Class()' /tmp/ccrBVE4S.o:(.rodata._ZTV17GeantVolumeBasket[vtable for GeantVolumeBasket]+0x1d0): undefined reference to `GeantVolumeBasket::ShowMembers(TMemberInspector&)' /tmp/ccrBVE4S.o:(.rodata._ZTV17GeantVolumeBasket[vtable for GeantVolumeBasket]+0x1d8): undefined reference to `GeantVolumeBasket::Streamer(TBuffer&)' /tmp/ccrBVE4S.o:(.rodata._ZTV11GeantOutput[vtable for GeantOutput]+0x1d0): undefined reference to `GeantOutput::ShowMembers(TMemberInspector&)' /tmp/ccrBVE4S.o:(.rodata._ZTV11GeantOutput[vtable for GeantOutput]+0x1d8): undefined reference to `GeantOutput::Streamer(TBuffer&)' collect2: ld returned 1 exit status

i am doing this because i want to make this multithreaded using openMP

amehrotr,

It looks like the compiler version you used to compile root in not the same as the one you used to compile your code.

[quote=“nbubis”]amehrotr,

It looks like the compiler version you used to compile root in not the same as the one you used to compile your code.[/quote]

Yes I used Intel compiler for building ROOT . But why should it affect this particular compilation ?

I get the same errors with icpc:

icpc PropagatorGeomCXX.cxx `root-config --cflags --evelibs`
/tmp/icpccdAOoZ.o: In function `__sti__$E':
PropagatorGeomCXX.cxx:(.text+0xa94a): undefined reference to `ROOT::GenerateInitInstance(GeantOutput const*)'
PropagatorGeomCXX.cxx:(.text+0xa969): undefined reference to `ROOT::GenerateInitInstance(GeantVolumeBasket const*)'
/tmp/icpccdAOoZ.o: In function `GeantVolumeBasket::IsA() const':
PropagatorGeomCXX.cxx:(.gnu.linkonce.t._ZNK17GeantVolumeBasket3IsAEv[.gnu.linkonce.t._ZNK17GeantVolumeBasket3IsAEv]+0x2): undefined reference to `GeantVolumeBasket::Class()'
/tmp/icpccdAOoZ.o: In function `GeantOutput::IsA() const':
PropagatorGeomCXX.cxx:(.gnu.linkonce.t._ZNK11GeantOutput3IsAEv[.gnu.linkonce.t._ZNK11GeantOutput3IsAEv]+0x2): undefined reference to `GeantOutput::Class()'
/tmp/icpccdAOoZ.o:(.gnu.linkonce.d._ZTV17GeantVolumeBasket[.gnu.linkonce.d._ZTV17GeantVolumeBasket]+0x1d0): undefined reference to `GeantVolumeBasket::ShowMembers(TMemberInspector&)'
/tmp/icpccdAOoZ.o:(.gnu.linkonce.d._ZTV17GeantVolumeBasket[.gnu.linkonce.d._ZTV17GeantVolumeBasket]+0x1d8): undefined reference to `GeantVolumeBasket::Streamer(TBuffer&)'
/tmp/icpccdAOoZ.o:(.gnu.linkonce.d._ZTV11GeantOutput[.gnu.linkonce.d._ZTV11GeantOutput]+0x1d0): undefined reference to `GeantOutput::ShowMembers(TMemberInspector&)'
/tmp/icpccdAOoZ.o:(.gnu.linkonce.d._ZTV11GeantOutput[.gnu.linkonce.d._ZTV11GeantOutput]+0x1d8): undefined reference to `GeantOutput::Streamer(TBuffer&)'

ah, i got it, hadn’t removed the ClassImp and ClassDef statements from the macro file. :unamused:

thanks guys.