undefined reference to actionlib::GoalIDGenerator::GoalIDGenerator()
I tried adapting the Actionlib Client-Tutorial to a action I already used in some python scripts but as soon as I insert
add_executable(urdf_optimizer_beta src/urdf_optimizer_beta.cpp)
target_link_libraries(urdf_optimizer_beta ${catkin_LIBRARIES})
add_dependencies(urdf_optimizer_beta pilatus_EXPORTED_TARGETS)
into the CMakeLists.txt i get the following error when trying to catkin_make
CMakeFiles/urdf_optimizer_beta.dir/src/urdf_optimizer_beta.cpp.o: In function `actionlib::GoalManager<pilatus::DrivePosesAction_<std::allocator<void> > >::GoalManager(boost::shared_ptr<actionlib::DestructionGuard> const&)':
/opt/ros/indigo/include/actionlib/client/client_helpers.h:80: undefined reference to `actionlib::GoalIDGenerator::GoalIDGenerator()'
CMakeFiles/urdf_optimizer_beta.dir/src/urdf_optimizer_beta.cpp.o: In function `actionlib::ActionClient<pilatus::DrivePosesAction_<std::allocator<void> > >::initClient(ros::CallbackQueueInterface*)':
/opt/ros/indigo/include/actionlib/client/action_client.h:214: undefined reference to `actionlib::ConnectionMonitor::ConnectionMonitor(ros::Subscriber&, ros::Subscriber&)'
/opt/ros/indigo/include/actionlib/client/action_client.h:217: undefined reference to `actionlib::ConnectionMonitor::goalDisconnectCallback(ros::SingleSubscriberPublisher const&)'
/opt/ros/indigo/include/actionlib/client/action_client.h:217: undefined reference to `actionlib::ConnectionMonitor::goalConnectCallback(ros::SingleSubscriberPublisher const&)'
/opt/ros/indigo/include/actionlib/client/action_client.h:221: undefined reference to `actionlib::ConnectionMonitor::cancelDisconnectCallback(ros::SingleSubscriberPublisher const&)'
/opt/ros/indigo/include/actionlib/client/action_client.h:221: undefined reference to `actionlib::ConnectionMonitor::cancelConnectCallback(ros::SingleSubscriberPublisher const&)'
CMakeFiles/urdf_optimizer_beta.dir/src/urdf_optimizer_beta.cpp.o: In function `actionlib::ActionClient<pilatus::DrivePosesAction_<std::allocator<void> > >::statusCb(ros::MessageEvent<actionlib_msgs::GoalStatusArray_<std::allocator<void> > const> const&)':
/opt/ros/indigo/include/actionlib/client/action_client.h:266: undefined reference to `actionlib::ConnectionMonitor::processStatus(boost::shared_ptr<actionlib_msgs::GoalStatusArray_<std::allocator<void> > const> const&, std::string const&)'
collect2: error: ld returned 1 exit status
make[2]: *** [devel/lib/pilatus/urdf_optimizer_beta] Error 1
make[1]: *** [CMakeFiles/urdf_optimizer_beta.dir/all] Error 2
make: *** [all] Error 2
The code that causes this crash is rather simple:
#include <ros/ros.h>
#include <actionlib/client/simple_action_client.h>
#include <actionlib/client/terminal_state.h>
#include <pilatus/DrivePosesAction.h>
int main (int argc, char **argv)
{
ros::init(argc, argv, "urdf_optimizer_beta");
actionlib::SimpleActionClient<pilatus::DrivePosesAction> ac("drive_poses", true);
return 0;
}
my CMakeLists.txt :
cmake_minimum_required(VERSION 2.8.3)
project(pilatus)
## Find catkin and any catkin packages
find_package(
catkin
REQUIRED COMPONENTS
roscpp
rospy
std_msgs
genmsg
actionlib_msgs
sensor_msgs
geometry_msgs
)
## Declare ROS messages and services
add_action_files(
DIRECTORY action
FILES DrivePoses.action
)
## Generate added messages and services
generate_messages(
DEPENDENCIES actionlib_msgs std_msgs sensor_msgs geometry_msgs
)
## Declare a catkin package
catkin_package(
CATKIN_DEPENDS actionlib_msgs
)
include_directories(include ${catkin_INCLUDE_DIRS})
add_executable(talker src/talker.cpp)
target_link_libraries(talker ${catkin_LIBRARIES})
add_dependencies(talker pilatus_generate_messages_cpp)
add_executable(listener src/listener.cpp)
target_link_libraries(listener ${catkin_LIBRARIES})
add_dependencies(listener pilatus_generate_messages_cpp)
add_executable(urdf_optimizer_beta src/urdf_optimizer_beta.cpp)
target_link_libraries(urdf_optimizer_beta ${catkin_LIBRARIES})
add_dependencies(urdf_optimizer_beta pilatus_EXPORTED_TARGETS)
Because of my python scripts which use the "DrivePose.action" successfully, I know that the action per se works. I therefore assume that the error must lie somewhere within the CMakeLists.txt . Any ideas what this could be?