libopencv_core.so.4.1 not found?

asked 2019-11-13 12:28:47 -0600

trolstover gravatar image

i have installed openCV and i have

>     ls local/lib/
>     cmake                       libopencv_dnn.so.4.1          
> libopencv_gapi.so          
> libopencv_imgcodecs.so.4.1.2 
> libopencv_objdetect.so.4.1   
> libopencv_videoio.so
>     libopencv_calib3d.so        libopencv_dnn.so.4.1.2        
> libopencv_gapi.so.4.1      
> libopencv_imgproc.so         
> libopencv_objdetect.so.4.1.2 
> libopencv_videoio.so.4.1
>     libopencv_calib3d.so.4.1    libopencv_features2d.so       
> libopencv_gapi.so.4.1.2    
> libopencv_imgproc.so.4.1     
> libopencv_photo.so           
> libopencv_videoio.so.4.1.2
>     libopencv_calib3d.so.4.1.2  libopencv_features2d.so.4.1   
> libopencv_highgui.so       
> libopencv_imgproc.so.4.1.2   
> libopencv_photo.so.4.1       
> libopencv_video.so
>     libopencv_core.so           libopencv_features2d.so.4.1.2 
> libopencv_highgui.so.4.1   
> libopencv_ml.so              
> libopencv_photo.so.4.1.2     
> libopencv_video.so.4.1
>     libopencv_core.so.4.1       libopencv_flann.so            
> libopencv_highgui.so.4.1.2 
> libopencv_ml.so.4.1          
> libopencv_stitching.so       
> libopencv_video.so.4.1.2
>     libopencv_core.so.4.1.2     libopencv_flann.so.4.1        
> libopencv_imgcodecs.so     
> libopencv_ml.so.4.1.2        
> libopencv_stitching.so.4.1   
> python2.7
>     libopencv_dnn.so            libopencv_flann.so.4.1.2      
> libopencv_imgcodecs.so.4.1 
> libopencv_objdetect.so       
> libopencv_stitching.so.4.1.2 
> python3.6

in my lib folder, now i am compilin it using

g++ main.cpp -I/home/matulmat/local/include/opencv4/ -L/home/matulmat/local/lib /home/matulmat/local/lib/*.so.*

and it compiles, but running it with

./a.out

returns

./a.out: error while loading shared libraries: libopencv_core.so.4.1: cannot open shared object file: No such file or directory

... but file libopencv_core.so.4.1 is in directory!. I tried linkin it usin -l

g++ main.cpp -I/home/matulmat/local/include/opencv4/ -L/home/matulmat/local/lib -lopencv_core -lopencv_highgui -lopencv_imgcodecs -lopencv_imgproc -lopencv_core.so.4.1

but it returned

cannot find -llibopencv_core.so.4.1

.. Why is this happeningg? How can i fix it? It seems its impossible to make openCV work...

Thanks for help!

edit retag flag offensive close merge delete

Comments

1

-L/home/matulmat/local/lib -- you installed to a non-standard path on linux, so you need to run ldconfig on that folder

berak gravatar imageberak ( 2019-11-13 14:10:58 -0600 )edit
1

and it should be -lopencv_core not -lopencv_core.do.4.1 in your cmdline

berak gravatar imageberak ( 2019-11-14 01:43:59 -0600 )edit