'filesystems "remove_all" vulnerability is not defined error
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:
Solution 1:[1]
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 )

Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
