Menu

Compilation Issues when adding boost options to plane.cc

Help
2020-07-03
2020-07-03
  • Anton Bredenbeck

    Hi,

    when trying to add boost options to the plane.cc file I am running into some compilation issues with boost. Specifically boost complains about the options that are not of a basic data type, i.e. the options that cause the error are:

    [...]
    input.add_options()
          ("format,f", po::value<IOType>(&type)->default_value(UOS,"uos"),
            "using shared library <arg> for input. (chose F from {uos, uos_map, "
            "uos_rgb, uos_frames, uos_map_frames, old, rts, rts_map, ifp, "
            "riegl_txt, riegl_rgb, riegl_bin, zahn, ply, las})")
            [...]
          ("plane,p", po::value<plane_alg>(&alg)->default_value(RHT,"rht"), 
            "Plane Detection Algorithm. Choose p from {rht, sht, pht, ppht, apht, ran}")
    

    If I comment these options out the compilatons runs without a problem. If not I get the following error message:

    Scanning dependencies of target planes
    [ 65%] Building CXX object src/shapes/CMakeFiles/planes.dir/plane.cc.o
    In file included from /usr/include/boost/move/utility_core.hpp:32:0,
                     from /usr/include/boost/move/utility.hpp:29,
                     from /usr/include/boost/thread/detail/move.hpp:27,
                     from /usr/include/boost/thread/lock_types.hpp:11,
                     from /usr/include/boost/thread/pthread/mutex.hpp:16,
                     from /usr/include/boost/thread/mutex.hpp:16,
                     from /home/anton/Programs/slam6d-code/include/slam6d/scan.h:23,
                     from /home/anton/Programs/slam6d-code/include/shapes/hough.h:8,
                     from /home/anton/Programs/slam6d-code/src/shapes/plane.cc:44:
    /usr/include/boost/lexical_cast/detail/converter_lexical.hpp: In instantiation ofstruct boost::detail::deduce_target_char_impl<boost::detail::deduce_character_type_later<IOType> >’:
    /usr/include/boost/lexical_cast/detail/converter_lexical.hpp:270:89:   required fromstruct boost::detail::deduce_target_char<IOType>/usr/include/boost/lexical_cast/detail/converter_lexical.hpp:407:92:   required fromstruct boost::detail::lexical_cast_stream_traits<std::__cxx11::basic_string<char>, IOType>/usr/include/boost/lexical_cast/detail/converter_lexical.hpp:468:15:   required fromstruct boost::detail::lexical_converter_impl<IOType, std::__cxx11::basic_string<char> >/usr/include/boost/lexical_cast/try_lexical_convert.hpp:196:44:   required frombool boost::conversion::detail::try_lexical_convert(const Source&, Target&) [with Target = IOType; Source = std::__cxx11::basic_string<char>]’
    /usr/include/boost/lexical_cast.hpp:41:60:   required fromTarget boost::lexical_cast(const Source&) [with Target = IOType; Source = std::__cxx11::basic_string<char>]’
    /usr/include/boost/program_options/detail/value_semantic.hpp:92:36:   required fromvoid boost::program_options::validate(boost::any&, const std::vector<std::__cxx11::basic_string<charT> >&, T*, long int) [with T = IOType; charT = char]’
    /usr/include/boost/program_options/detail/value_semantic.hpp:184:21:   required fromvoid boost::program_options::typed_value<T, charT>::xparse(boost::any&, const std::vector<std::__cxx11::basic_string<charT> >&) const [with T = IOType; charT = char]’
    /home/anton/Programs/slam6d-code/src/shapes/plane.cc:433:1:   required from here
    /usr/include/boost/lexical_cast/detail/converter_lexical.hpp:243:13: error: static assertion failed: Target type is neither std::istream`able nor std::wistream`able
                 BOOST_STATIC_ASSERT_MSG((result_t::value || boost::has_right_shift<std::basic_istream<wchar_t>, T >::value),
                 ^
    src/shapes/CMakeFiles/planes.dir/build.make:62: recipe for target 'src/shapes/CMakeFiles/planes.dir/plane.cc.o' failed
    make[2]: *** [src/shapes/CMakeFiles/planes.dir/plane.cc.o] Error 1
    CMakeFiles/Makefile2:3595: recipe for target 'src/shapes/CMakeFiles/planes.dir/all' failed
    make[1]: *** [src/shapes/CMakeFiles/planes.dir/all] Error 2
    Makefile:94: recipe for target 'all' failed
    make: *** [all] Error 2
    

    After some googling it seems like this might be some issue with the namespace po not knowing the enums IOTypes and plane_alg. But I'm not sure about it and especially not sure about how to resolve it. Is there some import missing or did I define the namespace incorrectly?

    I appreciate any help.

    Best,

    Anton

     
  • Dorit Borrmann

    Dorit Borrmann - 2020-07-03

    Hi Anton,
    for these none basic data types, you need to add a validate function. You can check it out, for example, in src/slam6d/exportPoints.cc it is implemented for the IOtype.
    I hope that helps!
    Best,
    Dorit

     
    • Anton Bredenbeck

      That was it. Thanks!

       

Log in to post a comment.