问题描述
我正在尝试包含<filesystem>
,但是当我使用名称空间时,它显示此错误:
std ::没有成员“文件系统”
我知道在更早的时候它是<experimental/filesystem>
并且名称空间是std :: experimental :: filesystem;
但是,当我这样做时,它也会给出类似的错误:
#error The <experimental/filesystem> header providing std::experimental::filesystem is deprecated by Microsoft \
and will be REMOVED. It is superseded by the C++17 <filesystem> header providing std::filesystem. \
You can define _SILENCE_EXPERIMENTAL_FILESYSTEM_DEPRECATION_WARNING to acknowledge that you have received this warning.
我正在使用Visual Studio 2019,并且C / C ++语言设置设置为最新版本。
那是什么原因引起的?
编辑1:所有导致错误的代码:
#include <iostream>
#include <Windows.h>
#include <filesystem>
namespace fs = std::filesystem;
int main() {
return 0;
}
edit 2:所有较旧的代码也有错误:
#include <iostream>
#include <Windows.h>
#include <experimental/filesystem>
namespace fs = std::experimental::filesystem;
int main() {
return 0;
}
编辑3:Visual Studio 2019项目配置设置->常规属性:
平台工具集:Visual Studio 2019(v142) C ++语言标准:ISO C ++ 17标准(std :: c ++ 17) Windows SDK版本10.0(最新安装的版本)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)