Skip to content

#include <filesystem> doesn't work with gcc-7 when -std=c++17 is specified. #3203

Closed
@sighingnow

Description

@sighingnow

What is the issue you have?

GCC 7 (on Ubuntu 18.04) doesn't have <filesystem>, instead, it has <experimental/filesystem> with namespace std::experimental::filesystem. When -std=c++17 is specified on Ubuntu 18.04 with GCC-7, this library fails to compile, as

#ifdef JSON_HAS_CPP_17
#include <filesystem>
#endif

doesn't work. The inclusion for <filesystem> requires more care with GCC.

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below
/home/runner/work/v6d/v6d/thirdparty/nlohmann-json/include/nlohmann/detail/conversions/from_json.hpp:23:14: fatal error: filesystem: No such file or directory
     #include <filesystem>
              ^~~~~~~~~~~~
compilation terminated.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions