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

[SOLVED] opencv my awesome library problem

asked 2015-01-25 16:51:51 -0500

Kailegh gravatar image

updated 2016-06-17 05:54:05 -0500

I have a problem when trying to run catkin_make, i am trying to build a package that uses opencv, i have added in CMakeLists : find_package(OpenCV) include_directories(${OpenCV_INCLUDE_DIRS}) target_link_libraries(my_awesome_library ${OpenCV_LIBRARIES}) but running catkin_make i get the folowing problem:

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

any idead what can I do? thanks a lot

EDIT 1: this is it

cmake_minimum_required(VERSION 2.8.3)
project(wificam)

find_package(catkin REQUIRED COMPONENTS
  cv_bridge
  roscpp
  std_msgs
  image_transport
  camera_info_manager

)


catkin_package(

)

include_directories(
  ${catkin_INCLUDE_DIRS}
)



find_package(OpenCV)
   include_directories(${OpenCV_INCLUDE_DIRS})
   #target_link_libraries(my_awesome_library ${OpenCV_LIBRARIES})

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

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

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

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

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

it is comented because if not i could not build it, how should I define that cmake target? I thought i had done it like it is explained in the opencv ros tutorial, i am still a noob sorry and thanks a lot

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2015-01-25 23:42:20 -0500

ahendrix gravatar image

updated 2015-01-28 13:57:18 -0500

This sort of error indicates that you haven't defined a cmake target called my_awesome_library.

The name of your cmake target is the first argument to add_executable(...) or add_library(...).

It may be useful to edit your question to include your full CMakeLists.txt if you would like more help.

EDIT

Your first CMake target is name wificamp; therefore your linking command should be:

target_link_libraries(wificamp ${OpenCV_LIBRARIES})

You can also combine this with the linking command that links your exectuable against the catkin libraries:

target_link_libraries(wificamp ${catkin_LIBRARIES} ${OpenCV_LIBRARIES})
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-01-25 16:51:51 -0500

Seen: 1,737 times

Last updated: Jun 17 '16