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

undefined reference to `StitchedMap::get_stitch()'

asked 2018-03-31 07:40:41 -0500

LokJai gravatar image

Hi everyone! I am new to ROS.

I am trying to convert the Mapstitch package ( https://github.com/tu-darmstadt-ros-p... ) from Rosbuild to Catkin. However, after I created a catkin package and modified the CMakeList, there are some errors when I compile the package. Could anyone tell what's the problem?

ROS: Indigo OS: Ubuntu 14.04

Errors

(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/lok/ws/devel/lib/mapstitch/mapstitch] Error 1
make[1]: *** [mapstitch/CMakeFiles/mapstitch.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
Linking CXX executable /home/lok/ws/devel/lib/mapstitch/main
CMakeFiles/main.dir/src/main.cpp.o: In function `main':
main.cpp:(.text+0x99f): undefined reference to `StitchedMap::StitchedMap(cv::Mat&, cv::Mat&, float)'
main.cpp:(.text+0x9e0): undefined reference to `StitchedMap::get_stitch()'
main.cpp:(.text+0xbaa): undefined reference to `StitchedMap::get_stitch()'
main.cpp:(.text+0xc5b): undefined reference to `StitchedMap::get_stitch()'
main.cpp:(.text+0xd6f): undefined reference to `StitchedMap::get_debug()'
main.cpp:(.text+0xe20): undefined reference to `StitchedMap::get_debug()'
main.cpp:(.text+0xeeb): undefined reference to `StitchedMap::~StitchedMap()'
main.cpp:(.text+0x16fc): undefined reference to `StitchedMap::~StitchedMap()'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/lok/ws/devel/lib/mapstitch/main] Error 1
make[1]: *** [mapstitch/CMakeFiles/main.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j2 -l2" failed

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(mapstitch)
find_package(catkin REQUIRED COMPONENTS
  roscpp
  tf
  std_msgs
  nav_msgs
  cv_bridge
)

catkin_package(
  INCLUDE_DIRS include
  LIBRARIES mapstitch
  CATKIN_DEPENDS roscpp tf cv_bridge
  DEPENDS system_lib OpenCV
)


include_directories(include ${catkin_INCLUDE_DIRS})
include_directories(include ${mapstitch})
include_directories(include mapstitch)
include_directories(include tclap)

add_executable(rosmain src/rosmain.cpp)
target_link_libraries(rosmain ${catkin_LIBRARIES})
add_dependencies(rosmain ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

add_executable(main src/main.cpp)
target_link_libraries(main ${catkin_LIBRARIES})
add_dependencies(main ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})

add_executable(mapstitch src/mapstitch.cpp)
target_link_libraries(mapstitch ${catkin_LIBRARIES})
add_dependencies(mapstitch ${${PROJECT_NAME}_EXPORTED_TARGETS} ${catkin_EXPORTED_TARGETS})
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-03-31 09:43:20 -0500

gvdhoorn gravatar image

The hector_mapstitch branch seems to contain a version that is already migrated to Catkin.

As to your problem: not all those .cpp files are stand-alone programs. At least the main target seems to also require the src/mapstitch.cpp as part of its source list.

edit flag offensive delete link more

Comments

Great, then I don't have to convert it by myself. One more thing to ask, the package listens to three topics /map, /world, /align but how can I obtain the stitched map and share to two robots?

LokJai gravatar image LokJai  ( 2018-04-01 03:55:35 -0500 )edit

It's considered 'bad form' to ask follow-up questions in comments under accepted answers on ROS Answers (any Q&A site really), unless they are conceptually close to the OP or ask for clarification of certain aspect of the answer. Seeing as neither is the case here, I suggest you post a new question.

gvdhoorn gravatar image gvdhoorn  ( 2018-04-01 06:23:15 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2018-03-31 07:39:04 -0500

Seen: 246 times

Last updated: Mar 31 '18