fatal error: filesystem: No such file or directory [closed]

六眼飞鱼酱① 提交于 2019-11-30 14:32:56

问题


Using, CentOs 7.1, gcc version 6.1.0 (GCC) I receive this error:

fatal error: filesystem: No such file or directory

on this line

#include <filesystem>

compiling with

g++ main.cpp -o main -std=c++17

where is the problem?


回答1:


It seems you have to include <filesystem> like this:

#include <experimental/filesystem>

Don't forget to add -lstdc++fs as a GCC flag!

Here is the proof: Coliru

If that doesn't work, then that probably means that you don't have filesystem in your configuration.

Also, as @MartinR. pointed out, the experimental is no longer needed in GCC 8+.



来源:https://stackoverflow.com/questions/39231363/fatal-error-filesystem-no-such-file-or-directory

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!