Advanced Modern C++ for Robotics Exercise 2.1

Hi.

I was trying to compile the Solution for Exercise 2.1
/usr/bin/ld: CMakeFiles/robot_heading_as_vector.dir/src/robot_heading_as_vector.cpp.o: in function main': robot_heading_as_vector.cpp:(.text+0xc2): undefined reference to RobotCommander::RobotCommander()’
/usr/bin/ld: robot_heading_as_vector.cpp:(.text+0xd1): undefined reference to RobotCommander::move_in_circles()' /usr/bin/ld: robot_heading_as_vector.cpp:(.text+0x134): undefined reference to RobotCommander::get_heading()’
/usr/bin/ld: robot_heading_as_vector.cpp:(.text+0x2c0): undefined reference to `RobotCommander::stop_moving()’
collect2: error: ld returned 1 exit status
make[2]: *** [sol_22/CMakeFiles/robot_heading_as_vector.dir/build.make:101: sol_22/robot_heading_as_vector] Error 1
make[1]: *** [CMakeFiles/Makefile2:418: sol_22/CMakeFiles/robot_heading_as_vector.dir/all] Error 2
make: *** [Makefile:141: all] Error 2
Invoking “make -j8 -l8” failed

can someone explain me the error? I just create the package ,copy the robot_heading_as_vector.cpp and the two lines to CMakeList.txt

Hello @Voltedge ,

From the errors you show, it looks like your code doesn’t know what RobotCommander is.

Did you download and compile the robot_commander class? This is asked at the beginning of the unit:

In case you’ve already done this, probably what you are missing is to add robot_commander to the find_package() function of your CMakeLists.txt:

find_package(catkin REQUIRED COMPONENTS
  roscpp
  robot_commander
)

Hope this helps,

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.