`filesystem` with c++17 doesn't work on my mac os x high sierra

前端 未结 3 2093
无人共我
无人共我 2020-12-05 13:57

I\'m following this tutorial:

http://www.bfilipek.com/2017/08/cpp17-details-filesystem.html

to checkout new c++ filesystem feature. However I\'m

3条回答
  •  Happy的楠姐
    2020-12-05 14:40

    As std::filesystem support on macOS with the official compiler and Xcode 11.1 is now limited to Catalina/10.15 deployment targets and up, I want to humbly add ghc::filesystem by myself as an additional option. It was written because I wanted to use std::filesystem on macOS, so it might be worth a try.

    It is a header-only feature complete implementation of std::filesystem for macOS, Linux and Windows, works from C++11 to C++17, and it tries to stay close to the standard. It might be a less heavy dependency than boost (if you don't use that already). In the simplest form, just drop the main header file next to your source, include filesystem.hpp, eventually add

    namespace fs = ghc::filesystem;
    

    and use it like it is std::filesystem. It is also possible to separate parts of the implementation into a cpp by using the additional header files, the readme explains how to do that.

    Note: It was implemented with utf8-everywhere in mind, but has an option to enable std::wstring interfaces on Windows as specified by the standard. The std::string_view related functions are limited to C++17, as it doesn't include a backport of std::string_view.
    More details can be found in the readme under differences in api.

提交回复
热议问题