# Rootcling with std::filesystem

**URL:** <https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388>\
**Category:** Newbie\
**Created:** [June 22, 2023, 2:27am UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388 "2023-06-22T02:27:02Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![haha123](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@haha123](https://root-forum.cern.ch/u/haha123)\
**Post date:** [June 22, 2023, 2:27am UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388/1 "2023-06-22T02:27:03Z")

</div>

Hi all,

I fail to use cling to compile a shared lib which uses std::filesystem. I have read some issues but I do not know if this has been fixed or there is any simple solution. To be specific,

```auto
// test.hh
#ifndef test_hh
#define test_hh
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;

class test
{
public:
    test();
    ~test();

private:
    fs::path path;
};

#endif

//test.cpp
#include "test.hh"
test::test()
{
    std::cout << "test constructor" << std::endl;
    this->path = ".";
}

test::~test()
{
    std::cout << "test destructor" << std::endl;
}

// compile error
root
.L test.cpp

```

Thanks a lot for your help.

_ROOT Version:_ 6.28.0 (built from conda)

* * *

---

<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:** [June 22, 2023, 7:07am UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388/2 "2023-06-22T07:07:57Z")

</div>

I tried your example. I did not get any error.

---

<div class="post-metadata">

**Author:** ![haha123](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@haha123](https://root-forum.cern.ch/u/haha123)\
**Post date:** [June 22, 2023, 11:02am UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388/3 "2023-06-22T11:02:54Z")

</div>

Hi,

I apologize. I made a typo. It causes an error when `.L test.cpp+` but is ok without `+`. The error message is ` error: '_List' is a private member of 'std::filesystem::path'`. I happen to get the same error when building with a LinkDef.h using cmake. Can you tell me what went wrong?

---

<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:** [June 22, 2023, 11:13am UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388/4 "2023-06-22T11:13:08Z")

</div>

For me, it is working with + too:

```auto
couet@macbookcouet Downloads % root   
   ------------------------------------------------------------------
  | Welcome to ROOT 6.29/01 https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for macosx64 on Jun 20 2023, 09:29:44 |
  | From heads/col-is-def@v6-29-01-1648-ge566d2865f |
  | With Apple clang version 12.0.5 (clang-1205.0.22.9) |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------------

root [0] .L test.cpp+
Info in <TMacOSXSystem::ACLiC>: creating shared library /Users/couet/Library/Mobile Documents/com~apple~CloudDocs/Downloads/./test_cpp.so
root [1] 

```

---

<div class="post-metadata">

**Author:** ![haha123](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/h/e19adc/32.png) [@haha123](https://root-forum.cern.ch/u/haha123)\
**Post date:** [June 22, 2023, 12:13pm UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388/5 "2023-06-22T12:13:45Z")

</div>

I see. I guess this is fine in the latest version. Thanks !

---

<div class="post-metadata">

**Author:** ![giraudpf](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@giraudpf](https://root-forum.cern.ch/u/giraudpf)\
**Post date:** [July 13, 2023, 2:47pm UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388/6 "2023-07-13T14:47:30Z")

</div>

Hello,

I confirm I am also affected by this in 6.28/04 (latest stable release). Running the example code provided at the top of this discussion, I get:

```auto
$ root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.28/04 https://root.cern |
  | (c) 1995-2022, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on May 16 2023, 14:45:00 |
  | From tags/v6-28-04@v6-28-04 |
  | With c++ (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0 |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------------

root [0] .L test.cpp+
Info in <TUnixSystem::ACLiC>: creating shared library /data/giraudpf/tmp/./test_cpp.so
input_line_11:6:22: error: '_List' is a private member of 'std::filesystem::path'
   filesystem::path::_List::_Impl_deleter _1;
                     ^
/usr/include/c++/9/bits/fs_path.h:558:12: note: declared private here
    struct _List
           ^
input_line_11:7:22: error: '_List' is a private member of 'std::filesystem::path'
   filesystem::path::_List::_Impl* _0;
                     ^
/usr/include/c++/9/bits/fs_path.h:558:12: note: declared private here
    struct _List
           ^
Error in <Load>: Could not declare TEmulatedTuple<filesystem::path::_List::_Impl*,filesystem::path::_List::_Impl_deleter>
root [1] 

```

Should I wait for another stable release before using std::filesystem::path?

Many thanks,  
Pierre-François

---

<div class="post-metadata">

**Author:** ![giraudpf](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/g/6a8cbe/32.png) [@giraudpf](https://root-forum.cern.ch/u/giraudpf)\
**Post date:** [August 30, 2023, 3:11pm UTC](https://root-forum.cern.ch/t/rootcling-with-std-filesystem/55388/7 "2023-08-30T15:11:38Z")

</div>

Hello,  
I see this issue is still there with the newly released 6.28.06:

```auto
$ root
   ------------------------------------------------------------------
  | Welcome to ROOT 6.28/06 https://root.cern |
  | (c) 1995-2023, The ROOT Team; conception: R. Brun, F. Rademakers |
  | Built for linuxx8664gcc on Aug 30 2023, 16:45:00 |
  | From tags/v6-28-06@v6-28-06 |
  | With c++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 |
  | Try '.help'/'.?', '.demo', '.license', '.credits', '.quit'/'.q' |
   ------------------------------------------------------------------

root [0] .L test.cpp+
Info in <TUnixSystem::ACLiC>: creating shared library /data/giraudpf/tmp/./test_cpp.so
input_line_11:6:22: error: '_List' is a private member of 'std::filesystem::path'
   filesystem::path::_List::_Impl_deleter _1;
                     ^
/usr/include/c++/11/bits/fs_path.h:636:12: note: declared private here
    struct _List
           ^
input_line_11:7:22: error: '_List' is a private member of 'std::filesystem::path'
   filesystem::path::_List::_Impl* _0;
                     ^
/usr/include/c++/11/bits/fs_path.h:636:12: note: declared private here
    struct _List
           ^
Error in <Load>: Could not declare TEmulatedTuple<filesystem::path::_List::_Impl*,filesystem::path::_List::_Impl_deleter>

```

Cheers,  
Pierre-François
