Tuesday, August 28, 2018

OpenCV shared libraries error

OpenCV shared libraries error


If you installed opencv on your linux machine and are able to compile opencv programs but cannot run them and are receiving the following error :

error while loading shared libraries: libcxcore.so.2: cannot open shared object file: No such file or directory

This means that the program is not able to locate the shared libraries it needs to execute. To sort this out you to have set the LD_LIBRARY_PATH environment variable to the path of your opencv lib directory. This directory should be located in your opencv installation directory(if you installed opencv using the tar rather than using your linux distribution repositories). You can do this by the following command (assuming you have installed opencv in your user directory in a folder named "opencv" :

export LD_LIBRARY_PATH=/home/{username}/opencv/lib/

If you are using the eclipse IDE and getting the same error then to fix it you need to open the Run configurations dialogue box which is located in the run menu, select the environment tab and add a new variable named LD_LIBRARY_PATH with value as described above.



visit link download