尝试使用Boost gil读取图像时出现错误

时间:2018-10-31 05:57:46

标签: c++ boost boost-gil

我正在尝试遵循boost gil教程-官方文档here

但是我在尝试读取图像时偶然发现了一些奇怪的错误,并不真正知道这些错误的含义。有想法吗?

我的代码:

#include <boost/gil/image.hpp>
#include <boost/gil/extension/io/jpeg.hpp>
#include <string>
using namespace boost::gil;

int main() {
    std::string filename("LittleMit.jpg");
    rgb8_image_t img;
    read_image(filename, img, jpeg_tag());
    return 0;
}

这是我遇到的错误(虽然有点长):

c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\gil\extension\io\jpeg\detail\reader_backend.hpp(266): error C2664: 'size_t boost::gil::detail::file_stream_device<FormatTag>::read(boost::gil::byte_t *,::size_t)': cannot convert argument 1 from 'JOCTET [4096]' to 'boost::gil::byte_t *'
        with
        [
           FormatTag=boost::gil::jpeg_tag
       ]
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\gil\extension\io\jpeg\detail\reader_backend.hpp(266): note: Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\gil\extension\io\jpeg\detail\reader_backend.hpp(264): note: while compiling class template member function 'boolean boost::gil::reader_backend<Device,boost::gil::jpeg_tag>::fill_buffer(jpeg_decompress_struct *)'
        with
        [
            Device=boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>
        ]
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\gil\extension\io\jpeg\detail\reader_backend.hpp(121): note: see reference to function template instantiation 'boolean boost::gil::reader_backend<Device,boost::gil::jpeg_tag>::fill_buffer(jpeg_decompress_struct *)' being compiled
        with
        [
            Device=boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>
        ]
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\gil\extension\io\jpeg\detail\read.hpp(59): note: see reference to class template instantiation 'boost::gil::reader_backend<Device,boost::gil::jpeg_tag>' being compiled
        with
        [
            Device=boost::gil::detail::file_stream_device<boost::gil::jpeg_tag>
        ]
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\gil\io\read_image.hpp(206): note: see reference to class template instantiation 'boost::gil::reader<boost::gil::detail::file_stream_device<FormatTag>,FormatTag,ConversionPolicy>' being compiled
        with
        [
            FormatTag=boost::gil::jpeg_tag,
            ConversionPolicy=boost::gil::detail::read_and_no_convert
        ]
c:\users\minh\source\repos\boosttest\boosttest\boosttest.cpp(12): note: see reference to function template instantiation 'void boost::gil::read_image<std::string,boost::gil::rgb8_image_t,boost::gil::jpeg_tag>(const String &,Image &,const FormatTag &,void *)' being compiled
        with
        [
            String=std::string,
            Image=boost::gil::rgb8_image_t,
            FormatTag=boost::gil::jpeg_tag
        ]
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(54): note: see reference to class template instantiation 'boost::arg<9>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(53): note: see reference to class template instantiation 'boost::arg<8>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(52): note: see reference to class template instantiation 'boost::arg<7>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(51): note: see reference to class template instantiation 'boost::arg<6>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(50): note: see reference to class template instantiation 'boost::arg<5>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(49): note: see reference to class template instantiation 'boost::arg<4>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(48): note: see reference to class template instantiation 'boost::arg<3>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(47): note: see reference to class template instantiation 'boost::arg<2>' being compiled
c:\program files (x86)\mingw-w64\i686-8.1.0-posix-dwarf-rt_v6-rev0\mingw32\boost_1_68_0\boost\bind\placeholders.hpp(46): note: see reference to class template instantiation 'boost::arg<1>' being compiled

0 个答案:

没有答案