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

undefined reference to `ros::Publisher::getTopic() const'

asked 2020-05-16 04:43:31 -0500

Wiew gravatar image

updated 2020-05-16 06:27:23 -0500

gvdhoorn gravatar image

Hi there, i have a question. I wanna to connect urg_node to my ROS (running on jetson nano). I installed ROS melodic, configure system and i wanna to compile using catkin_make my urg_node. i know tis package wanna several packages like laser_proc, urg_c and driver_common. i wanna to build all packages but catkin say:

CMakeFiles/laser_proc.dir/src/laser_proc.cpp.o: In function `main':
laser_proc.cpp:(.text.startup+0x50): undefined reference to `ros::init(int&, char**, std::string const&, unsigned int)'
laser_proc.cpp:(.text.startup+0x94): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)'
laser_proc.cpp:(.text.startup+0xec): undefined reference to `ros::NodeHandle::NodeHandle(std::string const&, std::map<std::string, std::string, std::less<std::string>, std::allocator<std::pair<std::string const, std::string> > > const&)'
/home/wiew/catkin_ws/devel/lib/liblaser_proc_ROS.so: undefined reference to `ros::console::initializeLogLocation(ros::console::LogLocation*, std::string const&, ros::console::levels::Level)'
**/home/wiew/catkin_ws/devel/lib/liblaser_publisher.so: undefined reference to `ros::Publisher::getTopic() const'
collect2: error: ld returned 1 exit status**
laser_proc/CMakeFiles/laser_proc.dir/build.make:154: recipe for target '/home/wiew/catkin_ws/devel/lib/laser_proc/laser_proc' failed
make[2]: *** [/home/wiew/catkin_ws/devel/lib/laser_proc/laser_proc] Error 1
CMakeFiles/Makefile2:2329: recipe for target 'laser_proc/CMakeFiles/laser_proc.dir/all' failed
make[1]: *** [laser_proc/CMakeFiles/laser_proc.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[ 89%] Built target LaserProcNodelet
Makefile:140: recipe for target 'all' failed
make: *** [all] Error 2
Invoking "make -j4 -l4" failed

I tried to add "add_compile_options(-std=c++11)" to CmakeList in laser_proc package and I elliminate several errors caused by wrong c++ standart but this error not.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2021-03-11 19:30:57 -0500

Skelon gravatar image

hey! i meet the same question, and i check the Cmakelists.txt and found that i the “target_link” in line 150, and i change wrong in other line,. i hope this suggestion can help you and others.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-05-16 04:43:31 -0500

Seen: 398 times

Last updated: May 16 '20