<cmath> <---> <TMath> Include Collisions

Hello Rooters,

So I think this should be a pretty simple problem to debug, but I haven’t found much to help from reading, so I’m goin’ right to the experts.

It appears that I am having some / collisions at compilation. (I am not using ACliC, but compiling source linked to the ROOT framework) I am guessing that the problem is occurring due to the order of the includes in other compiled and linked sources, or because of the order of the header search path, but I’m not sure.

Relevant Info:
Dev. Envt: XCode V 3.2.6 64-bit
Compile Info:

gcc-4.2 -x c++ -arch x86_64

OTHER_LDFLAGS = -L/Users/atb03a/Research/root/lib -lCore -lCint -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lXMLIO -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lz -pthread -Wl,-rpath,/Users/atb03a/Research/root/lib -lm

HEADER_SEARCH_PATHS = /Users/atb03a/Research/root/include/**

LIBRARY_SEARCH_PATHS = $(inherited) "$(SRCROOT)/ATLASTools/PileupReweighting-00-00-13/StandAlone"/**

OTHER_CPLUSPLUSFLAGS = -D_REENTRANT -pthread -R__NOSTATS -I/Users/atb03a/Research/root/include

//My source documents are quite abstracted and modular... so providing compilable source would probably more trouble than its worth at this point. However, it will be provided upon request, if pertinent.  

The Following Header File:

[code]#ifndef egammaOQ_h
#define egammaOQ_h

//#include “TROOT.h”
#include “TString.h”
#include “TFile.h”
#include “TH2I.h”
#include “TNamed.h”

#include
#include
#include
#include

//— Colliding Libs
#include <TMath.h>
#include
//--------------------

using namespace std;

class egammaOQ : public TNamed {

public:
.
.
.

};

#endif

[/code]

Results in the following errors:

In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:54, from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.h:16, from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.cpp:18: /Users/atb03a/Research/root/include/Math/math.h: In function 'double ROOT::Math::log1p(double)': /Users/atb03a/Research/root/include/Math/math.h:65: error: '::log1p' has not been declared /Users/atb03a/Research/root/include/Math/math.h: In function 'double ROOT::Math::expm1(double)': /Users/atb03a/Research/root/include/Math/math.h:76: error: '::expm1' has not been declared In file included from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.h:16, from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.cpp:18: /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath: At global scope: /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:229: error: '::fabs' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:261: error: '::fmod' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:271: error: '::frexp' has not been declared

Where as:

//--- Colliding Libs #include <cmath> \\ --\ __ Switched #include <TMath.h> \\ --/ //--------------------

Gives:

In file included from /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:54, from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.h:16, from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.cpp:18: /Users/atb03a/Research/root/include/Math/math.h: In function 'double ROOT::Math::log1p(double)': /Users/atb03a/Research/root/include/Math/math.h:65: error: '::log1p' has not been declared /Users/atb03a/Research/root/include/Math/math.h: In function 'double ROOT::Math::expm1(double)': /Users/atb03a/Research/root/include/Math/math.h:76: error: '::expm1' has not been declared In file included from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.h:16, from /Users/atb03a/Research/HighEnergy/ATLAS/Software/HEP-ANA-D3PD/D3PD-Analysis/ATLASTools/EGammaOQ_2011-00-00-04.r119489/checkOQ.cpp:18: /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath: At global scope: /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:100: error: '::acos' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:116: error: '::asin' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:132: error: '::atan' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:148: error: '::atan2' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:165: error: '::ceil' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:181: error: '::cos' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:197: error: '::cosh' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:213: error: '::exp' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:229: error: '::fabs' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:245: error: '::floor' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:261: error: '::fmod' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:271: error: '::frexp' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:287: error: '::ldexp' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:303: error: '::log' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:319: error: '::log10' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:335: error: '::modf' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:354: error: '::pow' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:376: error: '::sin' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:392: error: '::sinh' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:408: error: '::sqrt' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:424: error: '::tan' has not been declared /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/cmath:440: error: '::tanh' has not been declared

I have seen this problem many times earlier, however, in the interest of expediency, I fixed this by modifying my code to use TMath functions and only TMath functions. However, cmath is not a function sub-set of TMath, so I have reluctantly found myself having to confront this problem more directly.

Your time/help is much appreciated.
~Austin

Hi Austin,

Which version of ROOT are you using? Did you try include cmath before TMath.h?

Philippe.