Whenever I run this code I get segmentation fault(core dumped)
. It compiles without error or warnings but I still get the segfault.
I'm running on Ubuntu 19.04 on amd ryzen 2400g
I've compiled it on g++-8 and clang-8, and in both I get the seg fault.
After debugging it to catch the segfault, I found it in fs::path's destructor which is =default
#include <iostream>
#include <filesystem>
namespace fs = std::filesystem;
int main()
{
fs::path p = fs::current_path();
std::cout << p.c_str() << std::endl;
}
This is only supposed to print out the directory that the program is run from. I tried this to run recusrsive_directory_iterator
to make a directory viewer but I ended up with the error.