Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

OpenCV: "libopencv_core.so.2.3: cannot open shared object file: No such file or directory"

Tags:

c++

opencv

I've just installed OpenCV on my Debian machine, and I'm having issues with it. I followed the install guide on the Wiki. Trying to compile the examples gives what appears to be a successful compile, however trying to run them ends up throwing an error:

fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ g++ -Wall em.cpp
-lopencv_core -lopencv_imgproc -lopencv_calib3d -lopencv_video
-lopencv_features2d -lopencv_ml -lopencv_highgui -lopencv_objdetect
-lopencv_contrib -lopencv_legacy
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ ./a.out
./a.out: error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ pkg-config opencv
--libs-L/usr/local/lib -lopencv_core -lopencv_imgproc -lopencv_highgui
-lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d
-lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$

But even doing this doesn't work:

fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ g++ -Wall em.cpp
`pkg-config opencv --cflags --libs`
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$ ./a.out
./a.out: error while loading shared libraries: libopencv_core.so.2.3:
cannot open shared object file: No such file or directory
fagg@hubble:~/src/OpenCV-2.3.1/samples/cpp$

I think there's an issue with the linking, but I'm not quite sure what's going on. This is a completely fresh install of OpenCV - I've never had it on this machine before. Does anyone have any ideas?

like image 469
NOP Avatar asked Mar 12 '12 03:03

NOP


1 Answers

Ran

sudo ldconfig

Suggested by anon.coward

like image 142
NOP Avatar answered Oct 27 '22 12:10

NOP