Rootcling ignores loading of library within macro


It seems that the call to gSystem->Load("someLib") behaves differently if done within a macro than when done directly in the interpreter:

Loading with macro

$ root -b reproducer.C
Processing math_convert_reproducer.C...
IncrementalExecutor::executeFunction: symbol '_ZN4ROOT4Math9gv_detail7convertERKNS0_9AxisAngleERNS0_11EulerAnglesE' unresolved while linking [cling interface function]!
You are probably missing the definition of ROOT::Math::gv_detail::convert(ROOT::Math::AxisAngle const&, ROOT::Math::EulerAngles&)
Maybe you need to load the corresponding shared library?

Loading directly with rootcling

$ root -l
root [0] gSystem->Load("libGenVector");
root [1] .x reproducer.C;


using namespace ROOT::Math;

void reproducer() {

  auto axis = AxisAngle::AxisVector(1, 2, 3);
  double angle = 45;
  AxisAngle aa(axis, angle);
  EulerAngles ea(aa);

  cout << ea.Phi() << endl;

It looks to me like a bug. There are some tutorials that also load a library within the macro definition, but I think those libraries are loaded by default in rootcling, so they don’t error out.


Tested on ROOT v6.18/10 (from official released binaries), Linux Ubuntu 16.04

For ROOT 6, just in the beginning of your file, add:


Thanks that seems to do the trick!

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