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

ros-fuerte cannot find opencv package

asked 2014-03-14 05:05:59 -0500

Latif Anjum gravatar image

Hi there,

I have installed ros-fuerte-desktop-full. I am trying to built a package that contains opencv code, but I am getting the following error:

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

I have added following to CMakeLists.txt

target_link_libraries(MatObjects ${OpenCV_LIBS})

Here is the output of some flags:


This path contains opencv.pc

#pkg-config --cflags opencv
-I/opt/ros/fuerte/include/opencv -I/opt/ros/fuerte/include

#pkg-config --libs opencv
-L/opt/ros/fuerte/lib -lopencv_calib3d -lopencv_contrib -lopencv_core -lopencv_features2d -lopencv_flann -lopencv_gpu -lopencv_highgui -lopencv_imgproc -lopencv_legacy -lopencv_ml -lopencv_nonfree -lopencv_objdetect -lopencv_photo -lopencv_stitching -lopencv_ts -lopencv_video -lopencv_videostab

I have also tried to run the code on Geany using g++ with pkg-config --cflags opencv but it says Package opencv was not found in the pkg-config search path when it is there.

Please help.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-03-14 06:51:20 -0500

Wolf gravatar image

With rosmake, unlike catkin, you typically do not have to find_package and target_link_libraries opencv yourself. The only thing you have to do for developing against OpenCV with ros fuerte and rosbuild is to add a depend package to your manifest.xml:

  <depend package="opencv2"/>

Add this to your manifest.xml, remove

target_link_libraries(MatObjects ${OpenCV_LIBS})

from CMakeLists.txt, and tell me if it worked;)

edit flag offensive delete link more


I'm in agreement

aparraga gravatar image aparraga  ( 2014-03-14 08:04:48 -0500 )edit

Thanks sir. It worked. I am a bit surprised. I had ros-fuerte installed (before I refreshed ubuntu and installed fuerte again) and my previous method (linking libraries in CMakeLists.txt) was working. Has it changed recently?

Latif Anjum gravatar image Latif Anjum  ( 2014-03-14 10:36:07 -0500 )edit

I also use PCL libraries, so now I have to do the same for PCL libraries too? Previously, I was linking PCL libraries in CMakeLists.txt too and it was working.

Latif Anjum gravatar image Latif Anjum  ( 2014-03-14 10:36:32 -0500 )edit

One more thing: I use Geany and give build command: g++ "%f" `pkg-config --cflags --libs opencv` -o "%e". Previously it was working but not now. It says opencv.pc is not in the PKG_CONFIG path. I checked the path and opencv.pc is there. Any clue?

Latif Anjum gravatar image Latif Anjum  ( 2014-03-14 10:39:05 -0500 )edit

Geany Error: Package opencv was not found in the pkg-config search path. Perhaps you should add the directory containing `opencv.pc' to the PKG_CONFIG_PATH environment variable No package 'opencv' found

Latif Anjum gravatar image Latif Anjum  ( 2014-03-14 10:41:17 -0500 )edit

Question Tools

1 follower


Asked: 2014-03-14 05:05:59 -0500

Seen: 838 times

Last updated: Mar 14 '14