I compile the following code with gcc-9 in QtCreator in Ubuntu:
#include <filesystem>
using namespace std::filesystem;
int main()
{
bool any_new_folders = create_directories("aaa");
printf("success");
}
But a run-time error with message Segmentation fault (core dumped)
closes the program in line:
bool any_new_folders = create_directories("aaa");
however the folder aaa
is created beside the exe file. The exe file is created in a folder inside home folder.
Why does it happen and how can I solve the problem?
Step by step executions shows that the problem happens in a function named _M_split_cmpts
in fs_path.h
(line 184). fs_path.h
is a standard header file.