Xcode 10.2 now includes the <filesystem>
header. However, when writing code using std::filesystem
, I'm running into a lot of extra link errors.
Undefined symbols for architecture x86_64:
"std::__1::__fs::filesystem::path::__filename() const", referenced from:
std::__1::__fs::filesystem::path::filename() const in dump_zip.cpp.o
std::__1::__fs::filesystem::path::filename() const in libxp_parse.a(zipped.cpp.o)
std::__1::__fs::filesystem::path::remove_filename() in libxp_parse.a(zipped.cpp.o)
std::__1::__fs::filesystem::path::has_filename() const in libxp_parse.a(zipped.cpp.o)
std::__1::__fs::filesystem::path::has_filename() const in libxp_parse.a(acf.cpp.o)
I believe an extra library needs to be linked for filesystem support, but I can't identify what or where it is. Any idea what it is called?
EDIT: libc++ says that libc++fs
is required- however, that doesn't seem to be distributed with Xcode, at least not in the default search directories.
Xcode 10.2 does not contain the library support to implement <filesystem>
. The reason why it was not included in Xcode 10.2 is that the implementation of <filesystem>
did not have a stable ABI at the time.
So the behavior is expected, however it would be nicer if the error was more explicit about why this happens.
EDIT: As of Xcode 11 and MacOS 10.15, <filesystem>
is shipped in the main libc++.dylib and there's no need to link any additional library.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With