Hi, I'm trying to build some sources that require <filesystem> on 10.13 using clang 13 (I can try with clang 14, but I doubt that it helps).
What's the correct way to compile the following minimal example? Do I need to link against a newer libc++ somehow? If it's not feasible to do that, I'll target a newer OS, I was just silently hoping to have some success ;) Thank you, Mojca #include <cstdlib> #include <filesystem> int main() { auto cwd = std::filesystem::current_path(); printf("%s", cwd.c_str()); return EXIT_SUCCESS; } > clang++-mp-13 test.cpp -o test test.cpp:5:16: error: no member named 'filesystem' in namespace 'std'; did you mean 'std::__fs::filesystem'? auto cwd = std::filesystem::current_path(); ^~~~~~~~~~~~~~~ std::__fs::filesystem /opt/local/libexec/llvm-13/bin/../include/c++/v1/filesystem:268:1: note: 'std::__fs::filesystem' declared here _LIBCPP_BEGIN_NAMESPACE_FILESYSTEM ^ /opt/local/libexec/llvm-13/bin/../include/c++/v1/__config:816:58: note: expanded from macro '_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM' _LIBCPP_BEGIN_NAMESPACE_STD namespace __fs { namespace filesystem { ^ 1 error generated. > clang++-mp-13 -std=c++17 test.cpp -o test Undefined symbols for architecture x86_64: "std::__1::__fs::filesystem::__current_path(std::__1::error_code*)", referenced from: std::__1::__fs::filesystem::current_path() in test-1b2bbf.o ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation)