# Using RDataFrame in C++

**URL:** <https://root-forum.cern.ch/t/using-rdataframe-in-c/43634>\
**Category:** Newbie\
**Tags:** rdataframe\
**Created:** [February 20, 2021, 7:49pm UTC](https://root-forum.cern.ch/t/using-rdataframe-in-c/43634 "2021-02-20T19:49:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristian](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@Kristian](https://root-forum.cern.ch/u/Kristian)\
**Post date:** [February 20, 2021, 7:49pm UTC](https://root-forum.cern.ch/t/using-rdataframe-in-c/43634/1 "2021-02-20T19:49:59Z")

</div>

Hi,

I am trying to use RDataFrames in C++, but for some reason it does not exist in the ROOT namespace. More specifically in the sample code from the class reference neither EnableImplicitMT or RDataFrame can be found:

```auto
ROOT::EnableImplicitMT
ROOT::RDataFrame
auto myHisto = d.Histo1D("Branch_A");
myHisto->Draw();

```

I am not sure what I am doing wrong, and Googling the issue does not give me any results. Note that besides this, ROOT appears to work just fine. Can you guys tell me what is wrong? I am sorry if it is something trivial.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [February 21, 2021, 11:02am UTC](https://root-forum.cern.ch/t/using-rdataframe-in-c/43634/2 "2021-02-21T11:02:42Z")

</div>

Hi @Kristian ,  
and welcome to the ROOT forum. What ROOT version are you on? Also the snippet you posted is not really valid C++, there are some function arguments missing.

You can try:

```cpp
std::cout << ROOT::RDataFrame(1).Count().GetValue() << std::endl;

```

It should print `1`.

Cheers,  
Enrico

---

<div class="post-metadata">

**Author:** ![Kristian](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@Kristian](https://root-forum.cern.ch/u/Kristian)\
**Post date:** [February 21, 2021, 11:08am UTC](https://root-forum.cern.ch/t/using-rdataframe-in-c/43634/3 "2021-02-21T11:08:15Z")

</div>

I’m on version 6.22/07.

Your example doesn’t compile either, once again with the error message “no member named ‘RDataFrame’ in namespace ‘ROOT’.”

I don’t know if this information is relevant or not, but I can use the RDataFrames just fine in python.

---

<div class="post-metadata">

**Author:** ![eguiraud](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/eguiraud/32/32217_2.png) [@eguiraud](https://root-forum.cern.ch/u/eguiraud)\
**Post date:** [February 21, 2021, 5:25pm UTC](https://root-forum.cern.ch/t/using-rdataframe-in-c/43634/4 "2021-02-21T17:25:59Z")

</div>

Are you running that at the root prompt, or are you compiling a program? If you are compiling a program, you need to `#include <ROOT/RDataFrame.hxx>`

---

<div class="post-metadata">

**Author:** ![Kristian](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/k/e8c25b/32.png) [@Kristian](https://root-forum.cern.ch/u/Kristian)\
**Post date:** [February 21, 2021, 8:10pm UTC](https://root-forum.cern.ch/t/using-rdataframe-in-c/43634/5 "2021-02-21T20:10:40Z")

</div>

I could’ve sworn I’d already tried that, but it actually solved the issue. Thank you for the help.
