VS2017: E0135 namespace "std" has no member "filesystem"
Asked Answered
H

2

56

In order to use: std::filesystem from the C++17 library, my project was migrated from vs2015 to vs2017.

My project compiles and runs without error, the lib is included without error, but when trying to use std::filesystem I get the following:

1

It seems the library is not being included but cant see why not?

Edit:

Microsoft Visual Studio Enterprise 2017
VisualStudio.15.Release/15.7.3+27703.2026
Visual C++ 2017   00369-90000-00000-AA466
Microsoft Visual C++ 2017
Hosbein answered 3/6, 2018 at 16:57 Comment(0)
P
108

A couple of options to investigate.

  • Check the language standard. You need C++17 or above: enter image description here enter image description here
  • If your version of visual studio doesn't support std::filesystem yet, you can try std::experimental::filesystem.

I have the following version and std::filesystem works (with the C++17 language selection shown above):

Microsoft Visual Studio Community 2017 Preview
Version 15.8.0 Preview 1.1
VisualStudio.15.Preview/15.8.0-pre.1.1+27705.2000
Phore answered 3/6, 2018 at 17:22 Comment(7)
That setting in your pic was blank when I checked, making it the same as yours resolved the issue, you saved me hours of heartache there Wally TVM!Hosbein
Thank you very much. works perfectly for me. In my case its the std::any that is missingManila
I have got fully updated vs2017 and std::filesystem does not work. Any idea?Windy
@shout I updated from vs2017 15.4 or something to 15.9, and updated my windows SDK from 10.16 to 10.17 and restarted vs2017 and it works for me.Reposition
please provide a like for vs 2017 comparability with std ::filesystemBlowzed
I would like to add that in VS 2019 you need to put the debug mode on x64 on top of setting C++ 2017 as the standard.Vizierate
MaestroMau can you explain this in more detail? Because I am using 2019 and I do not find the second option you mention. Setting C++17 is not enough.Cerveny
F
4

I had a common issue, that filesystem was not recognized as std member for Linux environment only (on Windows it was fine).

For me adding the #include <filesystem> in the .hpp file as well solved the problem (although in theory, I didn't need this include there).

Fisher answered 9/8, 2021 at 14:41 Comment(2)
Don't know why and how, but it helped. Thanks!Ordinal
I had the problem on Windows. This solved it.Symphonize

© 2022 - 2024 — McMap. All rights reserved.