Hemang Purohit
Hemang Purohit

Reputation: 49

fail to compile simple Opencv C++ file with CMake

Hi I am trying to run a simple C++ program with Opencv to display Image file but I am getting following error.

The imported target "opencv_core" references the file

 "/usr/local/lib/libopencv_core.so.3.2.0"

but this file does not exist. Possible reasons include:

Call Stack (most recent call first): /usr/local/share/OpenCV/OpenCVConfig.cmake:111 (include) CMakeLists.txt:3 (find_package)

-- Configuring incomplete, errors occurred!

The code for which is an example given in opencv here: http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_gcc_cmake/linux_gcc_cmake.html#linux-gcc-usage

I tried to use opencv 3.2 before but I uninstalled n deleted all the opencv files using sudo apt-get remove libopencv*

I found similar question here: CMake does not find OpenCV but couldnt understand the answer. I have ROS Indigo installed on ubuntu 14.04.4. Also, I tried to install Opencv 2.4.13 but when I am checking the version installed using following command

pkg-config --modversion opencv

2.4.8

I am getting 2.4.8 and the main question why its referencing the file /usr/local/lib/libopencv_core.so.3.2.0 ?

FYI I installed opencv as per the instructions given here: http://docs.opencv.org/2.4/doc/tutorials/introduction/linux_install/linux_install.html#linux-installation

Thank you

Upvotes: 1

Views: 1068

Answers (2)

user15360574
user15360574

Reputation: 1

If you have more than one OpenCV installed in your computer, you could delete your OpenCV folder or you could move your folder to your temp folder:

sudo mv /usr/local/share/OpenCV /temp/OpenCV

It worked for me!!

Upvotes: 0

Hemang Purohit
Hemang Purohit

Reputation: 49

So I figured it out, apparently I had linking problem because of bad instalment. I uninstalled opencv , deleted all the files and reinstalled it. I could have solved it using symlink as well but figured its best to clear everything and reinstall it. worked perfectly.

Additional note : Its my observation that if you have ROS installed and saved the opt/ros/indigo/setup.bash in ~/.bashrc , it will give errors so better remove those lines from ~/.bashrc and then try again.

any other suggestion ??

Upvotes: 0

Related Questions