how to use std::filesystem on gcc 8?
Add the filesystem library as an argument to your compiler that will be forwarded to the linker. Also make sure you are using C++17. Both g++ and clang++ accepts this particular format:
--std=c++17 -lstdc++fs
Because of the silly rep system, I can't make this a comment on slashmais's answer.
When using an IDE, make sure that you also set the compiler to be used to GCC8 or above.
In my case, despite being installed, CodeLite was using a lower version of GCC and causing headaches (re: not finding the header)!
Manually setting CodeLite to use gcc-8
(instead of just gcc
fixed this problem.