[英]c++17 `filesystem` is not a namespace-name
我想知道為什么在下面的代碼中,找不到命名空間filesystem
:
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;
}
錯誤:
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 版本 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.5)
<experimental/..>
表示實驗命名空間:
namespace fs = std::experimental::filesystem;
請參閱: http : //en.cppreference.com/w/cpp/experimental/fs/path
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.