Linker Error with experimental::filesystem
When attempting to implement C 1z features using the experimental::filesystem library in GCC 6.0, users may encounter a linker error. The error message indicates an undefined reference to std::experimental::filesystem::v1::__cxx11::path::_M_split_cmpts().
Reason:
The Filesystem TS is not a part of C 1z but a separate specification. GCC's implementation of this library is available in C 11 mode.
Solution:
To resolve this issue, link with -lstdc fs. The libstdc fs.a library must come after objects that depend on it in the linker command.
Updates:
The above is the detailed content of Why am I getting linker errors when using the experimental::filesystem library in GCC 6.0?. For more information, please follow other related articles on the PHP Chinese website!