MoveIt undefined reference when declared inside the function or class

871 views
Skip to first unread message

Arunava Nag

unread,
Sep 20, 2017, 11:21:52 PM9/20/17
to MoveIt! Users

Hello,

When I create a move group interface in my main it builds (catkin_make) all good. However, the same thing if I have in my callBack it throws error. I have checked other posts and examples. I have added the headers correctly and hopefully my Cmakelist and package XML.


When I include: #include <moveit/move_group_interface/move_group.h> it throws warning of depreciation and for some reason doesn't work and suggests me to use this: 

#include <moveit/move_group_interface/move_group_interface.h>

However it still throws error as bellow.


Using ROS Kinetic, Ubuntu 16.04.

Implementation:


static const std::string PLANNING_GROUP = "right_arm";
moveit::planning_interface::MoveGroupInterface move_group(PLANNING_GROUP);


Basically checking the tutorial here

Error:

/home/artc/catkin_ws/devel/lib/libsw_lib.so: undefined reference to `moveit::planning_interface::MoveGroupInterface::MoveGroupInterface(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::shared_ptr<tf::Transformer> const&, ros::WallDuration const&)'
/home/artc/catkin_ws/devel/lib/libsw_lib.so: undefined reference to `moveit::planning_interface::MoveGroupInterface::~MoveGroupInterface()'
collect2: error: ld returned 1 exit status
sawyer_robot/sawyer_interface/CMakeFiles/sw_node.dir/build.make:179: recipe for target '/home/artc/catkin_ws/devel/lib/sawyer_interface/sw_node' failed
make[2]: *** [/home/artc/catkin_ws/devel/lib/sawyer_interface/sw_node] Error 1
CMakeFiles/Makefile2:7765: recipe for target 'sawyer_robot/sawyer_interface/CMakeFiles/sw_node.dir/all' failed
make[1]: *** [sawyer_robot/sawyer_interface/CMakeFiles/sw_node.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2

Arunava Nag

unread,
Sep 20, 2017, 11:26:55 PM9/20/17
to MoveIt! Users
Robot used: Sawyer from rethink robotics.

v4hn

unread,
Sep 21, 2017, 9:36:14 AM9/21/17
to Arunava Nag, moveit...@googlegroups.com
Good Morning,

On Wed, Sep 20, 2017 at 08:21:52PM -0700, Arunava Nag wrote:
> I have added the headers correctly and hopefully my Cmakelist and package XML.

Your error is about missing library links, not about headers.
Make sure you have the appropriate `target_link_libraries` directive,
e.g. `target_link_libraries(sw_lib ${catkin_LIBRARIES})`.

If the problem persists feel free to file an issue with instructions
on how to reproduce this in detail.


v4hn

> When I include: #include <moveit/move_group_interface/move_group.h> it
> throws warning of depreciation and for some reason doesn't work and
> suggests me to use this:
>
> #include <moveit/move_group_interface/move_group_interface.h>
> However it still throws error as bellow.
>
>
> Using ROS Kinetic, Ubuntu 16.04.
>
> Implementation:
>
>
> static const std::string PLANNING_GROUP = "right_arm";
> moveit::planning_interface::MoveGroupInterface move_group(PLANNING_GROUP);
>
>
> Basically checking the tutorial here
> <http://docs.ros.org/kinetic/api/moveit_tutorials/html/doc/pr2_tutorials/planning/src/doc/move_group_interface_tutorial.html>
>
> Error:
>
> /home/artc/catkin_ws/devel/lib/libsw_lib.so: undefined reference to `moveit::planning_interface::MoveGroupInterface::MoveGroupInterface(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, boost::shared_ptr<tf::Transformer> const&, ros::WallDuration const&)'
> /home/artc/catkin_ws/devel/lib/libsw_lib.so: undefined reference to `moveit::planning_interface::MoveGroupInterface::~MoveGroupInterface()'
> collect2: error: ld returned 1 exit status
> sawyer_robot/sawyer_interface/CMakeFiles/sw_node.dir/build.make:179: recipe for target '/home/artc/catkin_ws/devel/lib/sawyer_interface/sw_node' failed
> make[2]: *** [/home/artc/catkin_ws/devel/lib/sawyer_interface/sw_node] Error 1
> CMakeFiles/Makefile2:7765: recipe for target 'sawyer_robot/sawyer_interface/CMakeFiles/sw_node.dir/all' failed
> make[1]: *** [sawyer_robot/sawyer_interface/CMakeFiles/sw_node.dir/all] Error 2
> Makefile:138: recipe for target 'all' failed
> make: *** [all] Error 2
>
> --
> You received this message because you are subscribed to the Google Groups "MoveIt! Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to moveit-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/moveit-users/019bcc67-26a6-4de9-bf48-b54796f3845e%40googlegroups.com.


--
Michael Görner, M.Sc. Cognitive Science, PhD Student
Universität Hamburg
Faculty of Mathematics, Informatics and Natural Sciences
Department of Informatics
Group Technical Aspects of Multimodal Systems

Vogt-Kölln-Straße 30
D-22527 Hamburg

Room: F-315
Phone: +49 40 42883-2432
Website: https://tams.informatik.uni-hamburg.de/people/goerner/
signature.asc

Arunava Nag

unread,
Sep 21, 2017, 10:06:09 PM9/21/17
to MoveIt! Users
Hello, Thanks for your response. Here is my simple project attached which throws that error. If you catkin_build this project it should create the same error. I think i have linked the libraries correctly in my CMakeLists.

ROS version used: kinetic.
sawyer_interface.zip
Message has been deleted

Arunava Nag

unread,
Sep 24, 2017, 9:46:05 PM9/24/17
to MoveIt! Users
Hello,

Any update on this?


On Thursday, September 21, 2017 at 11:21:52 AM UTC+8, Arunava Nag wrote:

Arunava Nag

unread,
Oct 1, 2017, 10:11:45 PM10/1/17
to MoveIt! Users
Hello Michael,

Could you have a look at it yet?


On Thursday, September 21, 2017 at 9:36:14 PM UTC+8, v4hn wrote:

Arunava Nag

unread,
Oct 3, 2017, 5:05:50 AM10/3/17
to MoveIt! Users
Solved, the target_link_libraries worked out


On Thursday, September 21, 2017 at 9:36:14 PM UTC+8, v4hn wrote:
Reply all
Reply to author
Forward
0 new messages