# Enum in namespace not available after loading dictionary

**URL:** <https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757>\
**Category:** ROOT\
**Created:** [July 8, 2021, 5:20pm UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757 "2021-07-08T17:20:14Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Nicola\_Mori](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nicola_mori/32/23583_2.png) [@Nicola\_Mori](https://root-forum.cern.ch/u/Nicola_Mori)\
**Post date:** [July 8, 2021, 5:20pm UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/1 "2021-07-08T17:20:14Z")

</div>

* * *

This issue is a follow-up of a [previous post of mine](https://root-forum.cern.ch/t/cant-use-the-dictionary-for-an-enum-class-inside-a-namespace-without-the-rootmap/34481). In the first part of that thread I describe how an enum class inside a namespace is not available in the root shell, even after loading its dictionary, and the only way to make it available is to load the rootmap (e.g starting the shell from the folder where the dictionary library and the rootmap are) or manually load the header where the enum class is defined.  
I’m still facing the same issue with a modern Root version so I wonder whether this is intended behavior or a bug (and eventually if it is going to be fixed).  
Thanks.

_ROOT Version:_ 6.22.08  
_Platform:_ Archlinux  
_Compiler:_ GCC 11.1.0

* * *

---

<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:** [July 9, 2021, 5:34am UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/2 "2021-07-09T05:34:27Z")

</div>

I guess @axel can help you.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [July 13, 2021, 11:43am UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/3 "2021-07-13T11:43:57Z")

</div>

The issue of not being able to _store_ such an enum is fixed, right? (Referring to [https://sft.its.cern.ch/jira/browse/ROOT-10171](https://sft.its.cern.ch/jira/browse/ROOT-10171) here.)

The interpreter tries really hard to not parse headers - that’s costly, so it tries to find information elsewhere. Please add `#pragma link C++ namespace NS;` to make the namespace known to ROOT.

---

<div class="post-metadata">

**Author:** ![Nicola\_Mori](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nicola_mori/32/23583_2.png) [@Nicola\_Mori](https://root-forum.cern.ch/u/Nicola_Mori)\
**Post date:** [July 13, 2021, 12:17pm UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/4 "2021-07-13T12:17:41Z")

</div>

Hi Axel, honestly I lost track of the storing issue. We worked that around a few time ago, so I have to check from scratch; will do that in a while and report back directly on JIRA.

About the pragma, that doesn’t seem to help at all. It is already present in the reproducer attached to the original thread, but it does not fix this issue.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [July 13, 2021, 12:50pm UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/5 "2021-07-13T12:50:33Z")

</div>

Argh sorry indeed, forgot to move the rootmap file! I’m checking.

---

<div class="post-metadata">

**Author:** ![Axel](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/axel/32/11084_2.png) [@Axel](https://root-forum.cern.ch/u/Axel)\
**Post date:** [July 13, 2021, 2:10pm UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/6 "2021-07-13T14:10:50Z")

</div>

[[dictgen] Also forward declare namespaces, typedefs, enums: by Axel-Naumann · Pull Request #8661 · root-project/root · GitHub](https://github.com/root-project/root/pull/8661) should be fixing the issue of the unknown namespace in the ROOT prompt after loading the library. Can you confirm that it fixes also your case? If you prefer we can get that PR merged first and you confirm with a nightly build of ROOT.

(I confused this and the I/O enum issue ROOT-10171 - apologies for the noise.)

---

<div class="post-metadata">

**Author:** ![Nicola\_Mori](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/nicola_mori/32/23583_2.png) [@Nicola\_Mori](https://root-forum.cern.ch/u/Nicola_Mori)\
**Post date:** [July 13, 2021, 4:26pm UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/7 "2021-07-13T16:26:37Z")

</div>

@Axel I tried the reproducer with Root commit `22a84ec3fceb` from your `dict-fwd-decl-ns-td-enum` branch. I confirm that it fixes the issue almost completely, the only leftover being that double tab does not work (i.e. `root[0] NS:: <tab> <tab>` does not autocomplete nor shows a list of available names in the namespace as it does when the rootmap file is loaded).

---

<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 27, 2021, 4:27pm UTC](https://root-forum.cern.ch/t/enum-in-namespace-not-available-after-loading-dictionary/45757/8 "2021-07-27T16:27:19Z")

</div>

Closed on July 27, 2021, 4:27pm UTC

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