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

Cannot specify link libraries for target "node_name" which is not built by this project.

asked 2019-09-01 15:42:54 -0500

nav3128 gravatar image

updated 2019-09-02 03:33:35 -0500

I'm trying to use opencv on kinetic. As per 4.1 on this wiki, I had to add a dependency on opencv2 and find_package in the CMakeLists.txt [instructions here].

This is my edited CMakeList.txt. I'm getting

 'CMake Error at pc_side/CMakeLists.txt:19 (target_link_libraries):
  Cannot specify link libraries for target "pc_side" which is not built by
  this project.

-- Configuring incomplete, errors occurred!
See also "/home/user/raspi/build/CMakeFiles/CMakeOutput.log".
See also "/home/user/raspi/build/CMakeFiles/CMakeError.log".
Makefile:906: recipe for target 'cmake_check_build_system' failed
make: *** [cmake_check_build_system] Error 1
Invoking "make cmake_check_build_system" failed

CMakeLists.txt

cmake_minimum_required(VERSION 2.8.3)
project(pc_side)

find_package(catkin REQUIRED COMPONENTS
  sensor_msgs
  cv_bridge
  rospy
  std_msgs
)

find_package(OpenCV)
include_directories(${OpenCV_INCLUDE_DIRS})
target_link_libraries(pc_side ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})

catkin_package()
include_directories(
  ${catkin_INCLUDE_DIRS}
)
edit retag flag offensive close merge delete

Comments

1

Please post the full error output copied from your terminal, not just the main error text.

Geoff gravatar image Geoff  ( 2019-09-01 17:30:30 -0500 )edit

I've edited the question to show the full error.

nav3128 gravatar image nav3128  ( 2019-09-02 02:06:01 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-09-02 03:39:27 -0500

The target_link_libraries tag is used to add the library dependencies of a specific binary (executable or library) that is built in the package, not the package as a whole.

If your trying to use OpenCV 2 on ROS kinetic it's already included, adding a dependency on the cv_bridge package should be all you need to do. Then you just need to add the correct header files and start using OpenCV in your code.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-09-01 15:42:54 -0500

Seen: 7,334 times

Last updated: Sep 02 '19