I was using CMake to build a project that requires <experimental/filesystem> in C++14. And I got undefined symbol: _ZNSt12experimental10filesystem2v17__cxx114path14_M_split_cmptsEv when running the binary.
Did I miss anything in the cmakelist.txt?
I was using CMake to build a project that requires <experimental/filesystem> in C++14. And I got undefined symbol: _ZNSt12experimental10filesystem2v17__cxx114path14_M_split_cmptsEv when running the binary.
Did I miss anything in the cmakelist.txt?
In this answer I'm assuming you have an older version of GCC, which doesn't support C++17 or
std::filesystem.For older versions of GCC, the filesystem library isn't part of the main standard library.
Instead it comes as a separate library that you need to explicitly link with.
If you don't already have a
target_link_librariescommand you need to add one for your target, that links with thestdc++fslibrary.