文件系统“ remove_all”漏洞不是定义的错误

发布于 2025-01-26 03:27:15 字数 746 浏览 0 评论 0 原文

您好,我启动了C ++和IM使用Visual Studio 2017,我希望DELETIN在文件夹中的所有文件/文件夹中,我尝试了此代码:

#include <iostream>
#include <filesystem>

using namespace std;

int main()
{
    remove_all("C:\myfolder");
    printf("All items deleted!");

    return 0;
}

remove(); 对我有用,但是 remove_all(); 甚至不起作用,即使我使用 #include&lt; filesystem&gt;

这是我使用 remove> remove_all(); ::

严重性代码描述项目文件行隐藏状态错误(活动) e0020“ remove_all”漏洞未定义。

可以修复吗?还是还有另一种方法可以删除文件夹中的所有文件?

不是:我的VisualStudio太懒惰了,有时它会显示出错误,即使我修复了错误。谢谢

我的C ++版本:

在此处输入图像描述

Hello i started c++ and im using Visual Studio 2017 and i want deletin all files/folder inside a folder and i tried this code:

#include <iostream>
#include <filesystem>

using namespace std;

int main()
{
    remove_all("C:\myfolder");
    printf("All items deleted!");

    return 0;
}

remove(); is works for me but remove_all(); doesn't work even i use #include <filesystem>

This is what i what i get while im using remove_all();:

Severity Code Description Project File Line Hide Status Error (active)
E0020 "remove_all" vulnerability is not defined.

is it possible to fix? or there another method to delete all files inside a folder?

Not: My VisualStudio is so laggy and sometimes it stay displays error even i fix it. Thanks

My c++ version:

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

简美 2025-02-02 03:27:15

我修改了摘要:添加 filesystem :: \\

#include <iostream>
#include <filesystem>

using namespace std;

int main()
{
    filesystem::remove_all("XX:\\XX\\TestFolder");
    printf("All items deleted!");

    return 0;
}

并在Project属性中使用C ++ 17。(右键单击该项目,您将看到属性< /代码>在最后一行的页面)

I modified the snippet: added filesystem:: and \\

#include <iostream>
#include <filesystem>

using namespace std;

int main()
{
    filesystem::remove_all("XX:\\XX\\TestFolder");
    printf("All items deleted!");

    return 0;
}

And use the C++ 17 in Project's properties.(Right click the project and you will see the properties page on the last line )
enter image description here

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文