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

TK27's profile - activity

2023-05-26 15:59:12 -0500 marked best answer How do i solve this"... .so: undefined reference to '..."

Hi, I have gone through the internet for hours for similar cases to mine but I've tried all solutions and hasn't got my code working. I'm using a library called "vdo_slam" which has been built and can be found in /usr/local/include/vdo_slam. In my project CMakeList.txt I can find_package(vdo_slam REQUIRED) with no error. The only problem I have is at the end of "catkin_build" I get several of these "undefined reference to ...." as shown below. I have tried several solutions as listed below. All these undefined references are declared and defined inside the "vdo_slam" package. Any help is appreciated. Thanks!

Known solutions I have taken:

  1. I looked for classes and functions mentioned in the errors and see if there are pure virtual destructors as mentioned in here but they are all defined solidly.

  2. I have tried to debug with "readelf" command as shown below referring to this. But i don't have the "libvdo_slam.so" which actually includes these functions in the error. I suppose i need to have "libvdo_slam.so" when i run this "readelf" command right? How can i add that?

Error code from "catkin_build":

/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `typeinfo for VDO_SLAM::Visualizer2D'
/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `vtable for VDO_SLAM::Visualizer2D'
/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `vtable for VDO_SLAM::SceneObject'
/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `VDO_SLAM::BoundingBox::BoundingBox(double, double, double, double)'
/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `VDO_SLAM::Scene::Scene()'
/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `VDO_SLAM::Visualizer2D::spinOnce(std::shared_ptr<VDO_SLAM::Scene>&)'
/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `VDO_SLAM::Scene::add_scene_object(std::shared_ptr<VDO_SLAM::SceneObject>&)'
/home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so: undefined reference to `VDO_SLAM::Visualizer2D::Visualizer2D(std::shared_ptr<VDO_SLAM::VisualizerParams>&)'
collect2: error: ld returned 1 exit status
my_realtime_vdo_slam/CMakeFiles/ros_vdoslam_node.dir/build.make:226: recipe for target '/home/tranks/testing_ws/devel/lib/my_realtime_vdo_slam/ros_vdoslam_node' failed
make[2]: *** [/home/tranks/testing_ws/devel/lib/my_realtime_vdo_slam/ros_vdoslam_node] Error 1
CMakeFiles/Makefile2:6593: recipe for target 'my_realtime_vdo_slam/CMakeFiles/ros_vdoslam_node.dir/all' failed
make[1]: *** [my_realtime_vdo_slam/CMakeFiles/ros_vdoslam_node.dir/all] Error 2
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j12 -l12" failed

$ readelf --dynamic /home/tranks/testing_ws/devel/lib/libmy_realtime_vdo_slam.so Here

This is my CMakeList.txt:

cmake_minimum_required(VERSION 3.10)
project(my_realtime_vdo_slam)

find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  flow_net
  geometry_msgs
  image_transport
  mask_rcnn
  message_generation
  midas_ros
  mono_depth_2
  nav_msgs
  python_service_starter
  roscpp
  sensor_msgs
  std_msgs
  tf
  tf2
  tf2_geometry_msgs
  tf2_ros
  tf2_sensor_msgs
  vision_msgs
  visualization_msgs
  nodelet
  message_filters
)

find_package(OpenCV)
find_package(vdo_slam REQUIRED)

## Generate messages in the 'msg' folder
add_message_files(
   FILES
   VdoSlamScene.msg
   VdoSlamMap.msg
   VdoSceneObject.msg
   VdoInput.msg
)

generate_messages(
  DEPENDENCIES 
    actionlib_msgs 
    geometry_msgs 
    std_msgs 
    sensor_msgs 
    mask_rcnn 
    vision_msgs
)


set(PROJECT_INCLUDE_DIRS
  include
  ${catkin_INCLUDE_DIRS}
  ${OpenCV_INCLUDE_DIRS}
  ${vdo_slam_INCLUDE_DIRS}
  )

include_directories(
  ${PROJECT_INCLUDE_DIRS}
)  


catkin_package(
  INCLUDE_DIRS ${PROJECT_INCLUDE_DIRS}
  LIBRARIES ${PROJECT_NAME} 
  CATKIN_DEPENDS 
    roscpp
    image_transport 
    python_service_starter 
    std_msgs 
    tf 
    tf2 
    tf2_geometry_msgs 
    tf2_ros 
    tf2_sensor_msgs 
    nav_msgs 
    sensor_msgs 
    geometry_msgs 
    cv_bridge 
    flow_net 
    mask_rcnn 
    mono_depth_2 
    midas_ros 
    message_runtime 
    nodelet
    message_filters
  # DEPENDS system_lib
)

add_library ...
(more)
2021-12-13 04:50:01 -0500 received badge  Famous Question (source)
2021-05-08 13:21:56 -0500 commented answer Publish ROSBAG in synch with /clock by roscpp

@Weasfas did you get the answer? I have a similar issue where Im synchronizing 5 different topics using a rosbag. It wor

2021-05-02 10:39:10 -0500 commented answer How do i solve this"... .so: undefined reference to '..."

@gvdhoorn Thanks for the notice. Cheers

2021-05-02 07:47:49 -0500 commented question accidentally deleted build folder inside the catkin_ws folder

@skpro19 well that's solved then haha....just use that new workspace.

2021-05-02 07:44:56 -0500 commented answer accidentally deleted build folder inside the catkin_ws folder

@skpro19 Was it working before you deleted the build folder? The error message seems like you have issues with generatin

2021-05-02 07:44:45 -0500 commented answer accidentally deleted build folder inside the catkin_ws folder

Was it working before you deleted the build folder? The error message seems like you have issues with generating message

2021-05-02 06:53:39 -0500 edited answer accidentally deleted build folder inside the catkin_ws folder

If you are building in catkin_ws, you don't need to include the <package_name>. Just catkin build will do. I would

2021-05-02 06:53:16 -0500 answered a question accidentally deleted build folder inside the catkin_ws folder

If you are building in catkin_ws, you don't need to include the <package_name>. Just catkin build will do. I would

2021-05-02 06:53:16 -0500 received badge  Rapid Responder (source)
2021-05-02 06:44:47 -0500 answered a question How do i solve this"... .so: undefined reference to '..."

I got a solution here.

2021-04-28 07:05:35 -0500 received badge  Notable Question (source)
2021-04-28 03:23:54 -0500 edited question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-28 03:17:50 -0500 commented question How do i solve this"... .so: undefined reference to '..."

@gvdhoorn Yes it should be ${vdo_slam_LIBRARIES} instead. I found that my current library is not linked to that libvdo_s

2021-04-28 03:17:38 -0500 edited question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-28 03:15:27 -0500 commented question How do i solve this"... .so: undefined reference to '..."

@gvdhoorn Yes it should be ${vdo_slam_LIBRARIES}. I found that my current library is not linked to that libvdo_slam.so w

2021-04-28 01:17:19 -0500 commented question How do i solve this"... .so: undefined reference to '..."

Yes Sorry i put it up in a rush. I have added what I have tried in the post. Please let me know if i need to add anythin

2021-04-28 01:17:09 -0500 commented question How do i solve this"... .so: undefined reference to '..."

Yes Sorry it put up in a rush. I have added what I have tried in the post. Please let me know if i need to add anything

2021-04-28 01:15:54 -0500 edited question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-28 01:15:25 -0500 received badge  Popular Question (source)
2021-04-28 01:15:19 -0500 edited question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-28 01:11:59 -0500 commented question How do i solve this"... .so: undefined reference to '..."

Yes Sorry it was put up in a rush. I have added what I have tried in the post. Please let me know if i need to add anyth

2021-04-28 01:10:52 -0500 edited question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-28 01:03:53 -0500 edited question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-28 01:03:53 -0500 received badge  Editor (source)
2021-04-28 00:52:30 -0500 edited question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-27 16:33:21 -0500 asked a question How do i solve this"... .so: undefined reference to '..."

How do i solve this"... .so: undefined reference to '..." Hi, I have gone through the internet for hours for similar cas

2021-04-09 01:46:39 -0500 received badge  Enthusiast
2021-03-29 07:08:02 -0500 received badge  Supporter (source)