Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

These are linker errors, indicating that you don't link against (at least) the tf library.

Did you create the package using the command shown in the tutorial? Specifically, this:

catkin_create_pkg learning_tf tf roscpp rospy turtlesim

If you can show the find_package(catkin REQUIRED COMPONENTS ..) part of your CMakeLists.txt, we may be able to spot what is wrong or missing.

These are linker errors, indicating that you don't link against (at least) the tf library.

Did you create the package using the command shown in the tutorial? Specifically, this:

catkin_create_pkg learning_tf tf roscpp rospy turtlesim

If you can show the find_package(catkin REQUIRED COMPONENTS ..) part of your CMakeLists.txt, we may be able to spot what is wrong or missing.


Edit:

add_executable(turtle_tf_broadcaster src/turtle_tf_broadcaster.cpp)
target_link_libraries(turtle_tf_broadcaster ${catkin_LIBRARIES})

cmake_minimum_required(VERSION 2.8.3)
project(learning_tf)

find_package(catkin REQUIRED COMPONENTS
  roscpp
  rospy
  tf
  turtlesim
)

This would appear to be a problem of statement order.

It's best not to have the add_executable(..) and target_link_libraries(..) lines at the top of your file.

Move those two lines below the find_package(catkin ..) line.

I expect things to start working then.

Finally, if you haven't yet, you may want to lookup a tutorial or two about CMake. That will make a lot of things related to build scripts and the kinds of errors you posted this question about much clearer.