there is a link error with:
$ g++-8 -static-libstdc++ -std=c++17 -lstdc++fs -g3 -o testpath testpath.cpp /usr/bin/ld: /tmp/ccWrH4Ho.o: in function `std::filesystem::__cxx11::path::path<char [5], std::filesystem::__cxx11::path>(char const (&) [5], std::filesystem::__cxx11::path::format)': /usr/include/c++/8/bits/fs_path.h:184: undefined reference to `std::filesystem::__cxx11::path::_M_split_cmpts()' collect2: error: ld returned 1 exit status
you won't see it with dynamic linking because in 9, the code from libstdc++fs is now integrated in the libstdc++ library.
there is a link error with:
$ g++-8 -static-libstdc++ -std=c++17 -lstdc++fs -g3 -o testpath testpath.cpp m::__cxx11: :path:: path<char [5], std::filesystem ::__cxx11: :path>( char const (&) [5], std::filesystem ::__cxx11: :path:: format) ': c++/8/bits/ fs_path. h:184: undefined reference to `std::filesyste m::__cxx11: :path:: _M_split_ cmpts() '
/usr/bin/ld: /tmp/ccWrH4Ho.o: in function `std::filesyste
/usr/include/
collect2: error: ld returned 1 exit status
you won't see it with dynamic linking because in 9, the code from libstdc++fs is now integrated in the libstdc++ library.