I'm trying to compile this project (following the instructions given). When building it with rosmake
, I get a bunch of undefined reference to cv::String::deallocate()
and undefined reference to cv::String::allocate(unsigned long)
. I find curious that I'm getting an error just in those functions while the rest of the OpenCV functions seem to be working properly.
I know this happens because the linker can't find the objects where these functions were compiled to, but I'm kind of new to the ROS build system and can't find what's wrong.
I've tried using the CMakeLists.txt
file provided, and also adding find_package(OpenCV REQUIRED)
and target_link_libraries(xxx xxx ${OpenCV_LIBRARIES})
, without that making any difference. I know OpenCV is installed and compiled properly (I've used it before), and I had installed ROS without any problems.
I'm using OpenCV 3, ROS Indigo, Ubuntu 14.04
I am using OpenCV 3.1.0(Bleeding edge), ROS Indigo, Ubuntu 14.04. I ran in to similar trouble when trying to compile LSD-SLAM
I added:
I also added opencv libs to target link libs:
Here is my CMakeLists.txt file:
I also had the samme issue. Could not comment Osian's solution due to lack of rep, but this is the procedure I used:
If you for some reason have OpenCV installed from source, enter your build directory and do:
Then finally
Do you have multi-versions Opencv? if you have, maybe you should add the path to
OpenCVConfig.cmake
intoCmakeList.txt
. Just under thecmake_minimum_required(VERSION 2.8.12)
,like so:That's all.
I had this exact same problem - same error messages, same setup. I've managed to solve it, though I'm not exactly sure of the steps I did which actually contributed. As far as I can tell, it was due to a conflict of OpenCV versions - I think I had old versions of OpenCV cluttering my /usr/include and /usr/local. I uninstalled all OpenCV packages (including the ROS ones) and including my from-source install of OpenCV3 (also in /usr/local). Then I installed the ROS package vision_opencv, which seemed to install OpenCV 2.4.8 (incidentally the one recommended by LSD SLAM). Of course, this could be annoying if you need OpenCV3 for other things, but I now have that as a local install in my home directory (I couldn't figure out how to get ROS to link to this).
I think this solved the problem, the only issue remaining was that I got error messages saying was not found. This was because the package install leaves it in (similar for all module include files), whereas the make install step of the from-source install copies them into the parent folder. To get around this I simply edited the #include in the only file in which it is used (lsd_slam_core/src/IOWrapper/OpenCV/ImageDisplay_OpenCV.cpp). That seemed to solve it!
I hope this helps, I can give further details if needed.