Can';t在用make和g+构建的代码中使用std::filesystem+; 我在用C++构建我的C++应用程序时遇到了一些问题。 我有这样的C++代码: #include <string> #include <iostream> #include <filesystem> using namespace std; namespace fs = std::filesystem; int main() { auto iter = fs::directory_iterator(fs::current_path()); while(iter._At_end()) { cout << iter->path() << endl; } return 0; }

Can';t在用make和g+构建的代码中使用std::filesystem+; 我在用C++构建我的C++应用程序时遇到了一些问题。 我有这样的C++代码: #include <string> #include <iostream> #include <filesystem> using namespace std; namespace fs = std::filesystem; int main() { auto iter = fs::directory_iterator(fs::current_path()); while(iter._At_end()) { cout << iter->path() << endl; } return 0; },c++,gcc,g++,gnu,C++,Gcc,G++,Gnu,所以,我不能使用std::filesystem名称空间类的成员,但如果我只想使用类(例如std::filesystem::path),那么一切都可以 软件版本: g++-9 (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0 GNU Make 4.2.1 希望您能帮助我。只要不要使用\u-At-end(),一切都会好起来。\u-At-u-end不是标准库的一部分。为什么你认为你可以使用它呢?安装g++-10软件包,我看到它在MSVC编译器上运行。这是否意味着g++不支持此

所以,我不能使用std::filesystem名称空间类的成员,但如果我只想使用类(例如std::filesystem::path),那么一切都可以

软件版本:

g++-9 (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
GNU Make 4.2.1

希望您能帮助我。

只要不要使用
\u-At-end()
,一切都会好起来。

\u-At-u-end
不是标准库的一部分。为什么你认为你可以使用它呢?安装
g++-10
软件包,我看到它在MSVC编译器上运行。这是否意味着g++不支持此方法?
g++-9 (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
GNU Make 4.2.1