Undefined symbol when excuting


I was using a relative old ROOT version 6.04/16, and I encountered likely a library problem.

The error message is MeasureScale:

symbol lookup error: /sps/atlas/l/lguo/ATLAS_Calibration/ZeeScaleFactors/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libTemplate.so: undefined symbol: _ZN12TTreeFormulaC1EPKcS1_P5TTree

I’m 99.9% percent sure the issue is from the following line in my cxx file:

TTreeFormula *tformula=new TTreeFormula(tformulaname.c_str(), m_setting.GetSelection().c_str(), inputTree);

I had tried to load some libraries for instance:

But it didn’t work.

Does anyone have the solution?

Thanks a lot,


Please read tips for efficient and successful posting and posting code

_ROOT Version: ROOT 6.04/16
_Platform: x86_64-slc6-gcc49-opt
_Compiler: rc


$ c++filt _ZN12TTreeFormulaC1EPKcS1_P5TTree
TTreeFormula::TTreeFormula(char const*, char const*, TTree*)

I.e. that’s the symbol you’re missing. It’s missing in libTemplate.so, see symbol lookup error: /sps/atlas/l/lguo/ATLAS_Calibration/ZeeScaleFactors/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libTemplate.so. That library should have been linked against the library containing TTreeFormula. The latter is a ROOT class; checking https://root.cern.ch/root/html604/TTreeFormula.html (the documentation page for that class for your ROOT version) tells us that it’s in libTreePlayer. You can check with ldd which libraries are linked against a library: ldd /sps/atlas/l/lguo/ATLAS_Calibration/ZeeScaleFactors/RootCoreBin/lib/x86_64-slc6-gcc49-opt/libTemplate.so should list libTreePlayer but I bet it doesn’t.

That’s what needs to be fixed. You can work around that by loading libTreePlayer yourself. “Your” cxx file is run how? Through ROOT’s prompt? Then R__LOAD_LIBRARY should have helped! If it’s a binary / library then you might get a workaround by linking that against libTreePlayer - might because many linkers realize these days that your binary doesn’t actually need libTreePlayer and will drop the dependency.



Hi Axel,

Thanks a lot for the detailed explanation.

  My cxx file is compiled with rc and to be used within RootCore


I guess it’ not prompt from ROOT.

  In fact, R__LOAD_LIBRARY didn't work for me(maybe it's because

I’m using RootCore).

  But eventually  with gSystem->Load("libTreePlayer.so"), the

code works.





Sounds like:

Hmm not really - the bug is with libTemplate.so eher which is not linked against libTreePlayer but should.

Well, I meant something that appears not for the first time:

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.