# Rootcling ignores loading of library within macro

**URL:** <https://root-forum.cern.ch/t/rootcling-ignores-loading-of-library-within-macro/35094>\
**Category:** Cling\
**Created:** [July 10, 2019, 12:01pm UTC](https://root-forum.cern.ch/t/rootcling-ignores-loading-of-library-within-macro/35094 "2019-07-10T12:01:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ahesam](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ahesam/32/19455_2.png) [@ahesam](https://root-forum.cern.ch/u/ahesam)\
**Post date:** [July 10, 2019, 12:01pm UTC](https://root-forum.cern.ch/t/rootcling-ignores-loading-of-library-within-macro/35094/1 "2019-07-10T12:01:37Z")

</div>

Hello,

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

```auto
$ 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

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

```

#### reproducer.C

```auto
using namespace ROOT::Math;

void reproducer() {
  gSystem->Load("libGenVector");

  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.

Cheers,  
Ahmad

* * *

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

---

<div class="post-metadata">

**Author:** ![Wile\_E\_Coyote](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/wile_e_coyote/32/12417_2.png) [@Wile\_E\_Coyote](https://root-forum.cern.ch/u/Wile_E_Coyote)\
**Post date:** [July 10, 2019, 2:59pm UTC](https://root-forum.cern.ch/t/rootcling-ignores-loading-of-library-within-macro/35094/2 "2019-07-10T14:59:47Z")

</div>

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

```auto
R__LOAD_LIBRARY(libGenVector)

```

---

<div class="post-metadata">

**Author:** ![ahesam](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/ahesam/32/19455_2.png) [@ahesam](https://root-forum.cern.ch/u/ahesam)\
**Post date:** [July 10, 2019, 4:26pm UTC](https://root-forum.cern.ch/t/rootcling-ignores-loading-of-library-within-macro/35094/3 "2019-07-10T16:26:29Z")

</div>

Thanks that seems to do the trick!

---

<div class="post-metadata">

**Author:** ![system](https://root-forum.cern.ch/uploads/default/original/3X/e/f/efe4f24398fd8ffeb76bccb6ecc46d9d9c003376.png) [@system](https://root-forum.cern.ch/u/system)\
**Post date:** [July 24, 2019, 4:39pm UTC](https://root-forum.cern.ch/t/rootcling-ignores-loading-of-library-within-macro/35094/4 "2019-07-24T16:39:31Z")

</div>

Closed on July 24, 2019, 4:39pm UTC

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