Using c++ classes - **Example P1** ERROR

This is a completely copy-paste exercise on c++ classes. The create_pkg command, .cpp file, launch file and makelists file are all taken directly from the tutorial with no edits. I made sure to source devel/setup.bash.

No error on compile.

Receive the following error when launching node:

ERROR: cannot launch node of type [my_cpp_class/bb8_move_circle_class]: can’t locate node [bb8_move_circle_class] in package [my_cpp_class]


It’s not recommended that you copy anything hook, line, sinker :wink:. That’s not the best way to learn. Who knows, the error might have been intentional so that copy-pasters will suffer a bit :slight_smile:.

What this error suggests is that the C++ source has not been built, or the source or package name is wrong. Did you see any message during catkin_make suggesting that a source C++ was been built? I recommend the following:

  • Create the package but don’t copy in the given CMakeLists.txt and package.xml. Just copy the C++ and launch files.
  • Ensure to use the right package and source names specified in the launch file.
  • Modify CMakeLists.txt yourself according to the guide on how to set it up to recognize the C++ file.
  • catkin_make
  • source devel/setup.bash
  • rospack profile

Please let us know how it goes.

Great. Thank you. The issue was in the xml file, I didn’t have the right dependencies.

1 Like