相关疑难解决方法(0)

为什么我不能在g ++ 4.9.2中使用<experimental/filesystem>?

我正在尝试使用文件系统.我有-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

c++ filesystems g++ libstdc++ c++11

25
推荐指数
1
解决办法
2万
查看次数

C++ Build 在 Xcode OSX 上失败并出现多个错误文件 IO ... 不可用:在 macOS 10.15 中引入

每当我尝试在 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)

c++ macos file-io xcode

5
推荐指数
2
解决办法
2439
查看次数

标签 统计

c++ ×2

c++11 ×1

file-io ×1

filesystems ×1

g++ ×1

libstdc++ ×1

macos ×1

xcode ×1