# Correct linking of the ROOT::Math

**URL:** <https://root-forum.cern.ch/t/correct-linking-of-the-root-math/48602>\
**Category:** ROOT\
**Tags:** math\
**Created:** [January 28, 2022, 2:42pm UTC](https://root-forum.cern.ch/t/correct-linking-of-the-root-math/48602 "2022-01-28T14:42:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![terawatt](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/terawatt/32/25153_2.png) [@terawatt](https://root-forum.cern.ch/u/terawatt)\
**Post date:** [January 28, 2022, 2:42pm UTC](https://root-forum.cern.ch/t/correct-linking-of-the-root-math/48602/1 "2022-01-28T14:42:06Z")

</div>

Hello, rooters!  
I’m trying to create a shared library with usage of ROOT::Math::legendre function. Compilation goes well, but when I try to call function which execute calculation with legendre, an error connected with linking arises. What I should add to Makefile to fix it?  
Minimal code is attached.  
[LegendreProblem.zip](https://root-forum.cern.ch/uploads/short-url/hKiQT0GaUAIoAO4cdnrg9IJiHdv.zip) (50.0 KB)

_ROOT Version:_ 6.24/02  
_Platform:_ x86-64  
_Compiler:_ g++

* * *

---

<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:** [January 28, 2022, 2:45pm UTC](https://root-forum.cern.ch/t/correct-linking-of-the-root-math/48602/2 "2022-01-28T14:45:51Z")

</div>

Try:

```auto
ROOTLIBS = `root-config --glibs` -lMathMore

```

---

<div class="post-metadata">

**Author:** ![moneta](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/moneta/32/19423_2.png) [@moneta](https://root-forum.cern.ch/u/moneta)\
**Post date:** [January 28, 2022, 2:47pm UTC](https://root-forum.cern.ch/t/correct-linking-of-the-root-math/48602/3 "2022-01-28T14:47:01Z")

</div>

Hi,

you need to include `libMathMore.so` to the list of linked libraries. In your Makefile do:

```auto
ROOTLIBS = `root-config --glibs` -lMathMore

```

Cheers,

Lorenzo

---

<div class="post-metadata">

**Author:** ![terawatt](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/terawatt/32/25153_2.png) [@terawatt](https://root-forum.cern.ch/u/terawatt)\
**Post date:** [January 31, 2022, 6:46am UTC](https://root-forum.cern.ch/t/correct-linking-of-the-root-math/48602/4 "2022-01-31T06:46:28Z")

</div>

Many thanks!

---

<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:** [February 14, 2022, 6:47am UTC](https://root-forum.cern.ch/t/correct-linking-of-the-root-math/48602/5 "2022-02-14T06:47:15Z")

</div>

Closed on February 14, 2022, 6:47am UTC

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