c ++ - 在raspberryy上使用boost :: filesystem :: directory_iterator进行分段错误

时间:2016-12-15 18:53:33

标签: c++ boost iterator raspberry-pi filesystems

我正在尝试通过目录进行迭代并捕获给定目录中的所有可用位图。

编译G ++ 6.2并更改我的RPI Zero上的SD卡后,我在设置boost::filesystem::direcotry_iterator itr(path)

时会收到Segfaults

以下是抛出段错误的代码:

boost::filesystem::path picturePath = "/path";

boost::filesystem::directory_iterator end_itr;

if (boost::filesystem::is_directory(picturePath))
{
    for (boost::filesystem::directory_iterator itr(picturePath); itr != end_itr; ++itr)
    {
        do somthing with the files;
    }
}

由于代码在两次更改之前工作,我相信代码仍然正确。但是为什么我在创建启动迭代器时会遇到段错误?

0 个答案:

没有答案