# GSLRandomEngine undefined symbols

**URL:** <https://root-forum.cern.ch/t/gslrandomengine-undefined-symbols/54650>\
**Category:** Newbie\
**Tags:** root\
**Created:** [April 26, 2023, 1:50pm UTC](https://root-forum.cern.ch/t/gslrandomengine-undefined-symbols/54650 "2023-04-26T13:50:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![JSHeines](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/j/ecb155/32.png) [@JSHeines](https://root-forum.cern.ch/u/JSHeines)\
**Post date:** [April 26, 2023, 1:50pm UTC](https://root-forum.cern.ch/t/gslrandomengine-undefined-symbols/54650/1 "2023-04-26T13:50:03Z")

</div>

Hi,

I’m trying to use the GSLRandomEngine class in a compiled program.

```auto
#include <iostream>
#include <Math/GSLRndmEngines.h>

int main()
{
   ROOT::Math::GSLRandomEngine rng;
   rng.Initialize();
   std::cout << rng.Rndm() << std::endl;
   return 0;
}

```

This example program works fine when i load it in the root interpreter, but when I try to compile it with

```auto
g++ `root-config --cflags --glibs` -o example example.cpp

```

I get the following error:

```auto
Undefined symbols for architecture x86_64:
  "ROOT::Math::GSLRandomEngine::Initialize()", referenced from:
      _main in ex-8d14d6.o
  "ROOT::Math::GSLRandomEngine::GSLRandomEngine()", referenced from:
      _main in ex-8d14d6.o
  "ROOT::Math::GSLRandomEngine::~GSLRandomEngine()", referenced from:
      _main in ex-8d14d6.o
  "ROOT::Math::GSLRandomEngine::operator()() const", referenced from:
      ROOT::Math::GSLRandomEngine::Rndm() const in ex-8d14d6.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

```

What does this mean, and what can I do to fix it?

\_ROOT Version: 6.28/00, from conda-forge  
_Platform:_ macos 10.15.7  
_Compiler:_ Apple clang version 12.0.0 (clang-1200.0.32.29)

* * *

---

<div class="post-metadata">

**Author:** ![couet](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/couet/32/12037_2.png) [@couet](https://root-forum.cern.ch/u/couet)\
**Post date:** [April 26, 2023, 2:18pm UTC](https://root-forum.cern.ch/t/gslrandomengine-undefined-symbols/54650/2 "2023-04-26T14:18:18Z")

</div>

I guess @moneta can help.

---

<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:** [April 26, 2023, 2:21pm UTC](https://root-forum.cern.ch/t/gslrandomengine-undefined-symbols/54650/3 "2023-04-26T14:21:14Z")

</div>

`$(root-config --cxx --cflags) -O2 -Wall -Wextra -o example example.cpp $(root-config --libs) -lMathMore`
