Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

VS2017: E0135 namespace "std" has no member "filesystem"

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
like image 306
LearnMore Avatar asked Jun 03 '18 16:06

LearnMore


2 Answers

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
like image 186
wally Avatar answered Nov 19 '22 14:11

wally


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).

like image 3
Adam Kuzański Avatar answered Nov 19 '22 13:11

Adam Kuzański