我正在尝试使用文件系统.我有-std=c++11 -std=c++1y我的CMakeLists.txt.GCC版本是4.9.2.但是,我有一个错误:
/home/loom/MyProject/src/main.cpp:5:35: fatal error: experimental/filesystem: No such file or directory
#include <experimental/filesystem>
^
compilation terminated.
Run Code Online (Sandbox Code Playgroud)
什么是正确的使用方式std::experimental::filesystem?
每当我尝试在 Mac 上的 Xcode 上构建代码时,都会收到以下错误。
我当前的系统:
macOS:版本 10.15.1 (19B88)
Xcode:版本 11.2.1 (11B500)
我的错误:
'path'不可用:macOS 10.15中引入
'current_path'不可用:macOS 10.15中引入
'operator/'不可用:macOS 10.15中引入
'path'不可用:macOS 10.15中引入
'path'不可用:macOS中引入10.15
主程序
#include <iostream>
#include <iomanip>
#include <fstream>
#include <string>
#include <filesystem>
using namespace std;
int main(int argc, char* argv[])
{
cout << "being exectued from:" << endl;
cout << argv[0] << endl;
std::__fs::filesystem::path cwd = std::__fs::filesystem::current_path() / "filename.txt"; // C++17
cout << "but the input.txt and output.txt files should be be in the following directory:" << endl;
cout …Run Code Online (Sandbox Code Playgroud)