VS2017:E0135命名空间" std"没有会员"文件系统"

时间:2018-06-03 16:57:46

标签: visual-studio-2017 c++17 std-filesystem

为了使用:C ++ 17库中的std :: filesystem,我的项目从vs2015迁移到了vs2017。

我的项目编译并运行没有错误,包含lib而没有错误,但是当尝试使用std :: filesystem时,我得到以下内容:

enter image description here

图书馆似乎没有被收录但是为什么不能看到?

编辑:

Microsoft Visual Studio Enterprise 2017

VisualStudio.15.Release/15.7.3+27703.2026

Visual C++ 2017 00369-90000-00000-AA466

Microsoft Visual C++ 2017

2 个答案:

答案 0 :(得分:17)

要调查的几个选项。

  • 检查语言标准。您需要C ++ 17或更高版本: enter image description here enter image description here
  • 如果您的Visual Studio版本尚未支持std::filesystem,您可以尝试std::experimental::filesystem

我有以下版本,std::filesystem有效(上面显示的是C ++ 17语言选择):

Microsoft Visual Studio Community 2017 Preview
Version 15.8.0 Preview 1.1
VisualStudio.15.Preview/15.8.0-pre.1.1+27705.2000

答案 1 :(得分:0)

我有一个常见问题,即 文件系统 未被识别为仅适用于 Linux 环境的 std 成员(在 Windows 上没有问题)。

对我来说,在 .hpp 文件中添加 #include <filesystem> 也解决了这个问题(虽然理论上,我不需要在那里包含这个)。

相关问题