OpenCV-ROS catkin_make error
Hi, I'm working with OpenCV and ROS in Ubuntu 18.04.5 Melodic, using the cv_bridge C++ tutorial ( http://wiki.ros.org/cv_bridge/Tutoria...)
I followed different guides to create the package and the specific node for the image_converter.cpp file (similar to the one described in the guide, basically this steps: https://www.youtube.com/watch?v=11-Xr...
when I tried to compile the workspace I got the following error:
CMakeFiles/image_converter.dir/src/image_converter.cpp.o: In function
ImageConverter::ImageConverter()': image_converter.cpp:(.text._ZN14ImageConverterC2Ev[_ZN14ImageConverterC5Ev]+0x4bc): undefined reference to
cv::namedWindow(cv::String const&, int)' CMakeFiles/image_converter.dir/src/image_converter.cpp.o: In functionImageConverter::~ImageConverter()': image_converter.cpp:(.text._ZN14ImageConverterD2Ev[_ZN14ImageConverterD5Ev]+0x36): undefined reference to
cv::destroyWindow(cv::String const&)' CMakeFiles/image_converter.dir/src/image_converter.cpp.o: In function `ImageConverter::imageCb(boost::shared_ptr<sensor_msgs::image_<std::allocator<void>const> const&)': image_converter.cpp:(.text._ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE[_ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE]+0x1d9): undefined reference to
cv::imshow(cv::String const&, cv::_InputArray const&)' image_converter.cpp:(.text._ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE[_ZN14ImageConverter7imageCbERKN5boost10shared_ptrIKN11sensor_msgs6Image_ISaIvEEEEE]+0x1fe): undefined reference to
cv::waitKey(int)' collect2: error: ld returned 1 exit status opencv_cpp/CMakeFiles/image_converter.dir/build.make:126: recipe for target '/home/cesarrg/OpenCVtuto_ws/devel/lib/opencv_cpp/image_converter' failed make[2]: * [/home/cesarrg/OpenCVtuto_ws/devel/lib/opencv_cpp/image_converter] Error 1 CMakeFiles/Makefile2:1264: recipe for target 'opencv_cpp/CMakeFiles/image_converter.dir/all' failed make[1]: [opencv_cpp/CMakeFiles/image_converter.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: ** [all] Error 2 Invoking "make -j8 -l8" failed
I've been looking in different forums and trying to find a solution but without luck.
May anyone can help me to solve it? Thanks in advance
)
It appears to be failing to link to the OpenCV library.
First, do you have OpenCV installed? For example, the following command
If installed, does the CMakeLists.txt mention the use of OpenCV? You will need to include the following
Perfect thanks, I did have OpenCV installed but indeed I forgot to add the other commands to the CMakeList.txt, thanks.
@miura can you help me with a similiar problem?
@Petros ADLATUS If it were a different issue, it would be different to comment here. You should create a page asking about your problem. I don't know if I can help you, but you need a page to ask your question to get started.
@miura haha didn't recognize you sorry :D but it's fine i find a solution for this