Search code examples
c++boostraspberry-pig++boost-filesystem

C++ Boost - __assert_fail was not declared in this scope


Currently I am developing library that will be used on Raspberry Pi 3. To loop through all files in a directory I decided to use boost::filesystem module. I have prepared this code:

#include <boost/foreach.hpp>
#include <boost/filesystem.hpp>

boost::filesystem::path targetDir(some_path);
boost::filesystem::directory_iterator it(targetDir), eod;

BOOST_FOREACH(boost::filesystem::path const& p, std::make_pair(it, eod))
{
    if (boost::filesystem::is_regular_file(p))
    {
        // do smth with file
    }
}

Boost has been installed through apt-get install libboost1.62-all-dev.

Unfortunately compiling in Visual Studio 2017 (on remote RPi target, g++ 4.9.2) gives me this bunch of errors:

__assert_fail was not declared in this scope (path_trails.hpp)
...
__assert_fail was not declared in this scope (path.hpp)
...
__assert_fail was not declared in this scope (shared_ptr.hpp)

What am I doing wrong?


Solution

  • The issue was not connected with boost. I had #include <Magick++.h> line above and this causes these output errors. After commenting this line everything runs fine, now I need to find why Magick++ is causing this compability issue.