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

undefined reference in using serial.h

asked 2019-04-04 01:40:31 -0500

arifle gravatar image

updated 2019-04-04 01:43:42 -0500

gvdhoorn gravatar image

Hello, I tried building a teleop_keyboard package with serial port dependency. The serial port dependency had been installed via sudo apt-get. After doing that, I did a reboot to my computer.

catkin_ws$ catkin_make 

Linking CXX executable /home/aa/omniprob_ws/devel/lib/teleop_keyboard/teleop_keyboard_node
CMakeFiles/teleop_keyboard_node.dir/src/eleop_keyboard_node.cpp.o: In function `callback(geometry_msgs::Twist_<std::allocator<void> > const&)':
teleop_keyboard_node.cpp:(.text+0x37b): undefined reference to `serial::Serial::Serial(std::string const&, unsigned int, serial::Timeout, serial::bytesize_t, serial::parity_t, serial::stopbits_t, serial::flowcontrol_t)'

teleop_keyboard_node.cpp:(.text+0x4d0): undefined reference to `serial::Serial::~Serial()'
teleop_keyboard_node.cpp:(.text+0x507): undefined reference to `serial::Serial::~Serial()'
CMakeFiles/teleop_keyboard_node.dir/src/omniprobe_teleop_keyboard_node.cpp.o: In function `main':
teleop_keyboard_node.cpp:(.text+0x5f9): undefined reference to `serial::Serial::Serial(std::string const&, unsigned int, serial::Timeout, serial::bytesize_t, serial::parity_t, serial::stopbits_t, serial::flowcontrol_t)'
teleop_keyboard_node.cpp:(.text+0x98f): undefined reference to `serial::Serial::readline(unsigned long, std::string)'
teleop_keyboard_node.cpp:(.text+0xe10): undefined reference to `serial::Serial::~Serial()'
teleop_keyboard_node.cpp:(.text+0x1046): undefined reference to `serial::Serial::~Serial()'
collect2: error: ld returned 1 exit status
make[2]: *** [/home/aa/teleop_keyboard_node] Error 1
make[1]: *** [teleop_keyboard/CMakeFiles/teleop_keyboard_node.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j4 -l4" failed
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2020-09-29 20:57:16 -0500

I met the same problem,my solution is to added serial in find_package in CMakeList.txt

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-04-04 01:40:31 -0500

Seen: 979 times

Last updated: Apr 04 '19