I am wondering why in the following code, the namespace filesystem
is not found:
g++ -std=c++17 main.cpp -lstdc++
// #include <filesystem> <- error, so changed to the following:
#include <experimental/filesystem>
namespace fs = std::filesystem;
int main()
{
return 0;
}
error:
main.cpp:3:21: error: ‘filesystem’ is not a namespace-name
namespace fs = std::filesystem;
^
main.cpp:3:31: error: expected namespace-name before ‘;’ token
namespace fs = std::filesystem;
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…