Reputation: 5153
Having troubles accessing the filesystem namespace -
Problem:
Leading Research:
How can I get the list of files in a directory using C or C++? - Stack Overflow
C++17 Filesystem - Codingame
Setup:
GCC/G++: 9.2.0
C++: C++17
Demo:
#include <iostream>
#include <filesystem>
using namespace std;
namespace fs = std::filesystem;
int main(void) {
return 0;
}
I have tried the std::experimental variant to no success. How can I get C++17 & the <filesystem>
API working?
Soln Update:
Thank you P Kramer, w/MSYS2 I was able to quickly come to solution.
Procedure:
Upvotes: 0
Views: 342
Reputation: 12956
https://gcc.gnu.org/gcc-9/changes.html mentions incomplete filesystem implementation on windows. Goto compiler explorer and compile your sample with gcc 9.2 first. See here : https://godbolt.org/z/q9vTcernn This will indeed fail, if you change to latest gcc (for windows) everything compiles fine.
So the problem is the compiler version you are using.
Upvotes: 1