Hey, I’m facing an annoying build error in the actions quiz:
[ 97%] Building CXX object actions_quiz/CMakeFiles/ardrone_takeoff.dir/src/ardrone_takeoff_land.cpp.o
In file included from /usr/include/boost/bind.hpp:22,
from /opt/ros/noetic/include/ros/publisher.h:35,
from /opt/ros/noetic/include/ros/node_handle.h:32,
from /opt/ros/noetic/include/ros/ros.h:45,
from /opt/ros/noetic/include/actionlib/server/simple_action_server.h:41,
from /home/user/catkin_ws/src/actions_quiz/src/ardrone_takeoff_land.cpp:1:
/usr/include/boost/bind/bind.hpp: In instantiation of 'void boost::_bi::list2<A1, A2>::operator()(boost::_bi::type<void>, F&, A&, int) [withF = boost::_mfi::mf1<void, TakeoffLandAction, const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>; A = boost::_bi::rrlist1<const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>; A1 = boost::_bi::value<TakeoffLandAction*>; A2 = boost::arg<1>]':
/usr/include/boost/bind/bind.hpp:1306:50: required from 'boost::_bi::bind_t<R, F, L>::result_type boost::_bi::bind_t<R, F, L>::operator()(A1&&) [with A1 = const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&; R = void; F = boost::_mfi::mf1<void, TakeoffLandAction, const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>; L = boost::_bi::list2<boost::_bi::value<TakeoffLandAction*>, boost::arg<1> >; boost::_bi::bind_t<R, F, L>::result_type = void]'
/usr/include/boost/function/function_template.hpp:158:11: required from 'static void boost::detail::function::void_function_obj_invoker1<FunctionObj, R, T0>::invoke(boost::detail::function::function_buffer&, T0) [with FunctionObj = boost::_bi::bind_t<void, boost::_mfi::mf1<void,TakeoffLandAction, const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<TakeoffLandAction*>, boost::arg<1> > >; R = void; T0 = const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&]'
/usr/include/boost/function/function_template.hpp:931:38: required from 'void boost::function1<R, T1>::assign_to(Functor) [with Functor = boost::_bi::bind_t<void, boost::_mfi::mf1<void, TakeoffLandAction, const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<TakeoffLandAction*>, boost::arg<1> > >; R = void; T0 = const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&]'
/usr/include/boost/function/function_template.hpp:720:7: required from 'boost::function1<R, T1>::function1(Functor, typename boost::enable_if_<(! boost::is_integral<T>::value), int>::type) [with Functor = boost::_bi::bind_t<void, boost::_mfi::mf1<void, TakeoffLandAction, const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<TakeoffLandAction*>, boost::arg<1> > >; R = void; T0 = const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&; typename boost::enable_if_<(! boost::is_integral<T>::value), int>::type = int]'
/usr/include/boost/function/function_template.hpp:1068:16: required from 'boost::function<R(T0)>::function(Functor, typename boost::enable_if_<(! boost::is_integral<T>::value), int>::type) [with Functor = boost::_bi::bind_t<void, boost::_mfi::mf1<void, TakeoffLandAction, const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>, boost::_bi::list2<boost::_bi::value<TakeoffLandAction*>, boost::arg<1> > >; R = void; T0 = const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&; typename boost::enable_if_<(! boost::is_integral<T>::value), int>::type = int]'
/home/user/catkin_ws/src/actions_quiz/src/ardrone_takeoff_land.cpp:35:26: required from here
/usr/include/boost/bind/bind.hpp:319:35: error: no match for call to '(boost::_mfi::mf1<void, TakeoffLandAction, const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>) (TakeoffLandAction*&, const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&)'
319 | unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/bind/mem_fn.hpp:215,
from /usr/include/boost/mem_fn.hpp:22,
from /usr/include/boost/function/detail/prologue.hpp:18,
from /usr/include/boost/function.hpp:30,
from /opt/ros/noetic/include/ros/forwards.h:40,
from /opt/ros/noetic/include/ros/common.h:37,
from /opt/ros/noetic/include/ros/ros.h:43,
from /opt/ros/noetic/include/actionlib/server/simple_action_server.h:41,
from /home/user/catkin_ws/src/actions_quiz/src/ardrone_takeoff_land.cpp:1:
/usr/include/boost/bind/mem_fn_template.hpp:163:7: note: candidate: 'R boost::_mfi::mf1<R, T, A1>::operator()(T*, A1) const [with R = void; T = TakeoffLandAction; A1 = const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&]'
163 | R operator()(T * p, A1 a1) const
| ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:163:28: note: no known conversion for argument 2 from 'const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >' to 'const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&'
163 | R operator()(T * p, A1 a1) const
| ~~~^~
/usr/include/boost/bind/mem_fn_template.hpp:168:25: note: candidate: 'template<class U> R boost::_mfi::mf1<R, T, A1>::operator()(U&, A1) const [with U = U; R = void; T = TakeoffLandAction; A1 = const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&]'
168 | template<class U> R operator()(U & u, A1 a1) const
| ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:168:25: note: template argument deduction/substitution failed:
In file included from /usr/include/boost/bind.hpp:22,
from /opt/ros/noetic/include/ros/publisher.h:35,
from /opt/ros/noetic/include/ros/node_handle.h:32,
from /opt/ros/noetic/include/ros/ros.h:45,
from /opt/ros/noetic/include/actionlib/server/simple_action_server.h:41,
from /home/user/catkin_ws/src/actions_quiz/src/ardrone_takeoff_land.cpp:1:
/usr/include/boost/bind/bind.hpp:319:35: note: cannot convert '(& a)->boost::_bi::rrlist1<const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>::operator[](boost::_bi::storage2<boost::_bi::value<TakeoffLandAction*>, boost::arg<1> >::a2_)' (type 'const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >') to type 'const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&'
319 | unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/bind/mem_fn.hpp:215,
from /usr/include/boost/mem_fn.hpp:22,
from /usr/include/boost/function/detail/prologue.hpp:18,
from /usr/include/boost/function.hpp:30,
from /opt/ros/noetic/include/ros/forwards.h:40,
from /opt/ros/noetic/include/ros/common.h:37,
from /opt/ros/noetic/include/ros/ros.h:43,
from /opt/ros/noetic/include/actionlib/server/simple_action_server.h:41,
from /home/user/catkin_ws/src/actions_quiz/src/ardrone_takeoff_land.cpp:1:
/usr/include/boost/bind/mem_fn_template.hpp:176:25: note: candidate: 'template<class U> R boost::_mfi::mf1<R, T, A1>::operator()(const U&, A1) const [with U = U; R = void; T = TakeoffLandAction; A1 = const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> >>&]'
176 | template<class U> R operator()(U const & u, A1 a1) const
| ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:176:25: note: template argument deduction/substitution failed:
In file included from /usr/include/boost/bind.hpp:22,
from /opt/ros/noetic/include/ros/publisher.h:35,
from /opt/ros/noetic/include/ros/node_handle.h:32,
from /opt/ros/noetic/include/ros/ros.h:45,
from /opt/ros/noetic/include/actionlib/server/simple_action_server.h:41,
from /home/user/catkin_ws/src/actions_quiz/src/ardrone_takeoff_land.cpp:1:
/usr/include/boost/bind/bind.hpp:319:35: note: cannot convert '(& a)->boost::_bi::rrlist1<const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&>::operator[](boost::_bi::storage2<boost::_bi::value<TakeoffLandAction*>, boost::arg<1> >::a2_)' (type 'const boost::shared_ptr<const actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >') to type 'const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&'
319 | unwrapper<F>::unwrap(f, 0)(a[base_type::a1_], a[base_type::a2_]);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/include/boost/bind/mem_fn.hpp:215,
from /usr/include/boost/mem_fn.hpp:22,
from /usr/include/boost/function/detail/prologue.hpp:18,
from /usr/include/boost/function.hpp:30,
from /opt/ros/noetic/include/ros/forwards.h:40,
from /opt/ros/noetic/include/ros/common.h:37,
from /opt/ros/noetic/include/ros/ros.h:43,
from /opt/ros/noetic/include/actionlib/server/simple_action_server.h:41,
from /home/user/catkin_ws/src/actions_quiz/src/ardrone_takeoff_land.cpp:1:
/usr/include/boost/bind/mem_fn_template.hpp:184:7: note: candidate: 'R boost::_mfi::mf1<R, T, A1>::operator()(T&, A1) const [with R = void; T = TakeoffLandAction; A1 = const boost::shared_ptr<actions_quiz::CustomActionMsgGoal_<std::allocator<void> > >&]'
184 | R operator()(T & t, A1 a1) const
| ^~~~~~~~
/usr/include/boost/bind/mem_fn_template.hpp:184:22: note: no known conversion for argument 1 from 'TakeoffLandAction*' to 'TakeoffLandAction&'
184 | R operator()(T & t, A1 a1) const
| ~~~~^
make[2]: *** [actions_quiz/CMakeFiles/ardrone_takeoff.dir/build.make:63: actions_quiz/CMakeFiles/ardrone_takeoff.dir/src/ardrone_takeoff_land.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:660: actions_quiz/CMakeFiles/ardrone_takeoff.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking "make -j36 -l36" failed
I’m unable to find the error whether I’m doing something wrong in my includes or in my CMakeLists.txt or package.xml. The offending line and the preceding includes:
#include <actionlib/TestAction.h>
#include <actionlib/server/simple_action_server.h>
#include <geometry_msgs/Twist.h>
#include <ros/ros.h>
#include <std_msgs/Empty.h>
class MoveSquareAction {
protected:
ros::NodeHandle nh_;
// NodeHandle instance must be created before this line. Otherwise strange
// error occurs.
actionlib::SimpleActionServer<actionlib::TestAction> as_;
std::string action_name_;
My CMakeLists.txt
cmake_minimum_required(VERSION 3.0.2)
project(actions_quiz)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED COMPONENTS
actionlib
actionlib_msgs
roscpp
std_msgs
)
## Generate actions in the 'action' folder
add_action_files(
FILES
CustomActionMsg.action
# Action1.action
# Action2.action
)
## Generate added messages and services with any dependencies listed here
generate_messages(
DEPENDENCIES
actionlib_msgs
std_msgs
)
catkin_package(
# INCLUDE_DIRS include
# LIBRARIES actions_quiz
CATKIN_DEPENDS actionlib actionlib_msgs roscpp
# DEPENDS system_lib
)
###########
## Build ##
###########
## Specify additional locations of header files
## Your package locations should be listed before other locations
include_directories(
# include
${catkin_INCLUDE_DIRS}
)
add_executable(ardrone_takeoff src/ardrone_takeoff_land.cpp)
add_dependencies(ardrone_takeoff actions_quiz_generate_messages_cpp ${ardrone_takeoff_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
target_link_libraries(ardrone_takeoff
${catkin_LIBRARIES}
)
My package.xml’s main part:
<buildtool_depend>catkin</buildtool_depend>
<build_depend>actionlib</build_depend>
<build_depend>actionlib_msgs</build_depend>
<build_depend>roscpp</build_depend>
<build_export_depend>actionlib</build_export_depend>
<build_export_depend>actionlib_msgs</build_export_depend>
<build_export_depend>roscpp</build_export_depend>
<exec_depend>actionlib</exec_depend>
<exec_depend>actionlib_msgs</exec_depend>
<exec_depend>roscpp</exec_depend>