# How to know which library I need add to link

**URL:** <https://root-forum.cern.ch/t/how-to-know-which-library-i-need-add-to-link/62583>\
**Category:** Newbie\
**Created:** [January 4, 2025, 3:01pm UTC](https://root-forum.cern.ch/t/how-to-know-which-library-i-need-add-to-link/62583 "2025-01-04T15:01:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Xin](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/bbce88/32.png) [@Xin](https://root-forum.cern.ch/u/Xin)\
**Post date:** [January 4, 2025, 3:01pm UTC](https://root-forum.cern.ch/t/how-to-know-which-library-i-need-add-to-link/62583/1 "2025-01-04T15:01:18Z")

</div>

I don’t know how to know which libraries I need add additionally when I compiled ROOT code using g++, like this:

```bash
g++ -o main mian.c `root-config --cflags` `root-config --libs` -lMinuit -lGui -lEve -lGeom -lRGL

```

When I already have a code which I using “root -l” to run, but now I want to change it to compile mode, how can I know which library I need add besides the default libraries in `root-config --libs`.  
For example, I want to use THttpServer, I can use a code with THttpServer with “root -l”, but when I want to compile it using g++, I will get error like `undefined reference to `THttpServer::THttpServer(char const\*)'`, it can be solved by add `-lRHTTP` in the g++ compile command, but I know it quite by chance. So I want to know the best way when facing this problem.

By the way, I want to ask the best way to get or print all libraries provided by ROOT(in my ROOT environment ), like `root-config --libs` which only print the default libraries.

* * *

_ROOT Version:_ Not Provided  
_Platform:_ Not Provided  
_Compiler:_ Not Provided

* * *

---

<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 4, 2025, 3:38pm UTC](https://root-forum.cern.ch/t/how-to-know-which-library-i-need-add-to-link/62583/2 "2025-01-04T15:38:39Z")

</div>

> [@How to dump modulemap ".pcm" files](https://root-forum.cern.ch/t/how-to-dump-modulemap-pcm-files/39935/23):
>
> Just for the completeness of this thread … For (almost) all ROOT classes, somewhere in the middle of the [ROOT “Class Reference” web pages](https://root.cern/doc/master/classes.html), right before the “Inheritance diagram for ...:” graph (right before the “Member, Constructor, ..., Documentation” sections), one can find the information which “#include” files are needed. Starting with ROOT 6.12, at the bottom of these web pages, one can find the “Libraries for ...:” graph, which shows the library to link and its dependencies. For an exam…

---

<div class="post-metadata">

**Author:** ![Xin](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/x/bbce88/32.png) [@Xin](https://root-forum.cern.ch/u/Xin)\
**Post date:** [January 15, 2025, 6:07pm UTC](https://root-forum.cern.ch/t/how-to-know-which-library-i-need-add-to-link/62583/3 "2025-01-15T18:07:45Z")

</div>

Thank you very much!
