ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Error including ros headers

asked 2017-06-21 08:54:55 -0500

G gravatar image

updated 2017-06-24 04:30:02 -0500

Hello there!

I am having trouble with a ros project that thows curious errors when trying to catkin_make it. here is the error:

In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
             from /usr/include/boost/function/detail/function_iterate.hpp:14,
             from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
             from /usr/include/boost/function.hpp:64,
             from /opt/ros/indigo/include/ros/forwards.h:40,
             from /opt/ros/indigo/include/ros/common.h:37,
             from /opt/ros/indigo/include/ros/ros.h:43,
             from /**"my cpp file in the line where i include <ros/ros.h>"**
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void 
boost::detail::function::void_function_invoker1<FunctionPtr, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionPtr = void (*)(); R = void; T0 = const boost::shared_ptr<const visualization_msgs::InteractiveMarkerFeedback_<std::allocator<void> > >&]’:
/usr/include/boost/function/function_template.hpp:934:38:   required from ‘void boost::function1<R, T1>::assign_to(Functor) [with Functor = void (*)(); R = void; T0 = const boost::shared_ptr<const visualization_msgs::InteractiveMarkerFeedback_<std::allocator<void> > >&]’
/usr/include/boost/function/function_template.hpp:722:7:   required from ‘boost::function1<R, T1>::function1(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = void (*)(); R = void; T0 = const boost::shared_ptr<const visualization_msgs::InteractiveMarkerFeedback_<std::allocator<void> > >&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
/usr/include/boost/function/function_template.hpp:1069:16:   required from ‘boost::function<R(T0)>::function(Functor, typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type) [with Functor = void (*)(); R = void; T0 = const boost::shared_ptr<const visualization_msgs::InteractiveMarkerFeedback_<std::allocator<void> > >&; typename boost::enable_if_c<boost::type_traits::ice_not<boost::is_integral<Functor>::value>::value, int>::type = int]’
**"my cpp file"**.cpp:239:48:   required from here
/usr/include/boost/function/function_template.hpp:112:11: error: too many arguments to function
           BOOST_FUNCTION_RETURN(f(BOOST_FUNCTION_ARGS));

What i also don't get is that the error is first leading to the includes, but then the actual error aims into one of my files. The line targeted is as such (where server is a boost::shared_ptr<interactive_markers::InteractiveMarkerServer>):

server->insert(inter_marker, &functionName);

and a similar error on:

In file included from /usr/include/boost/function/detail/maybe_include.hpp:18:0,
                 from /usr/include/boost/function/detail/function_iterate.hpp:14,
                 from /usr/include/boost/preprocessor/iteration/detail/iter/forward1.hpp:52,
                 from /usr/include/boost/function.hpp:64,
                 from /opt/ros/indigo/include/ros/forwards.h:40,
                 from /opt/ros/indigo/include/ros/common.h:37,
                 from /opt/ros/indigo/include/ros/ros.h:43,
                 from **"my other cpp file where i include ros.h"**
/usr/include/boost/function/function_template.hpp: In instantiation of ‘static void boost::detail::function::void_function_invoker1<FunctionPtr, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionPtr = void (*)(std::basic_string<char>); R = void; T0 = const boost::shared_ptr<const visualization_msgs::InteractiveMarkerFeedback_<std::allocator<void> > >&]’:
/usr/include/boost/function/function_template.hpp:934:38:   required from ‘void boost::function1<R, T1 ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2017-06-27 08:20:43 -0500

G gravatar image

Sorry for stealing your time, but i am completely refactoring the related code so i won't be able to further diagnose this situation.

If anyone encounters something similar, the only advice i have is that i think this was all caused by inept use of "extern" in headers.

If you have trouble with global variables in ros, consider "rosparam" as an option, it has multiple advantages.

Thanks to everyone who read this anyway

edit flag offensive delete link more

Comments

later enountered a similar problem after the mentioned refactor, posted it on "stack overflow" as it was more about c++ in general after all. In case anyone else ever has this issue: https://stackoverflow.com/questions/4...

G gravatar image G  ( 2017-08-06 07:31:00 -0500 )edit
1

answered 2017-06-24 15:02:09 -0500

ahendrix gravatar image

There is something wrong with your function prototypes for the functions that you're trying to use as interactive marker callbacks.

The compiler isn't able to convert a function with that function signature into the type required by the interactive marker server and the menu handler. Since this was working in a pervious version, I would double-check that your function signatures are exactly the same, and that the interactive markers API is still the same. It's possible that the interactive markers server is expecting a new callback type on newer versions of ROS.

edit flag offensive delete link more

Comments

Thanks for your reply! Pittily, the only difference in the concerned code is that the variable definitions are outsourced in a header file. All includes are equal to the older version of the project, and that older project works fine on the same machine. Can it be the header or did i miss anything?

G gravatar image G  ( 2017-06-25 07:44:52 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2017-06-21 08:53:47 -0500

Seen: 1,440 times

Last updated: Jun 27 '17