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

learning_tf CMake Error Melodic

asked 2018-12-20 05:14:01 -0600

karl gravatar image

Hi I'm following the learning_tf tutorial ( http://wiki.ros.org/tf/Tutorials/Writ... ) using Ubuntu 18.04 and ROS Melodic.

I have a problem when I use catkin_make, it seems that it cannot find my cpp file in my src folder. Althought i follwoed the instructions correctly.

CMake Error at learning_tf/CMakeLists.txt:203 (add_executable):
  Cannot find source file:

    turtle_tf_broadcaster.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
  .hxx .in .txx


CMake Error: CMake can not determine linker language for target: turtle_tf_broadcaster
CMake Error: Cannot determine link language for target "turtle_tf_broadcaster".
-- Generating done
-- Build files have been written to: /home/karl/tutorial_ws/build
Makefile:1104: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

Any idea ??? I feel it is just a basic compiling error but i just can't find the solution ...

Thank you

edit retag flag offensive close merge delete

Comments

1

Is your turtle_tf_broadcaster.cpp file located in the src sub directory of your package? If it is, then do you list the source file as src/turtle_tf_broadcaster.cpp in CMakeLists.txt (note the src/ prefix there)?

If not, that is where the problem is.

gvdhoorn gravatar image gvdhoorn  ( 2018-12-20 05:39:25 -0600 )edit

Thanks for the answer. I can't save a file with src/ in its name so i just deleted this part.

karl gravatar image karl  ( 2018-12-20 05:45:31 -0600 )edit

Ok i found the solution ! thank you for your help !

karl gravatar image karl  ( 2018-12-20 05:47:36 -0600 )edit

I can't save a file with src/ in its name so i just deleted this part.

src is a directory, not part of the filename.

gvdhoorn gravatar image gvdhoorn  ( 2018-12-20 05:57:35 -0600 )edit

Ok i found the solution ! thank you for your help !

can you please tell us how you solved your problem?

gvdhoorn gravatar image gvdhoorn  ( 2018-12-20 05:57:49 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-12-20 07:01:29 -0600

karl gravatar image

To fix the problem, I had to :

Put my learning_tf folder in my catkin_ws/src folder. Paste my turtle_tf_broadcaster.cpp file in the learning_tf/src folder.

Add :

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

In my CMakeLists.txt file in the learning_tf folder.

And finally use $ catkin_make command in the catkin_ws folder !

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-12-20 05:14:01 -0600

Seen: 320 times

Last updated: Dec 20 '18