Had to change som CXX11 foreach style for loops to BOOST_FOREACH