Install Opencv ON eclipse in ubuntu

asked 2015-12-20 11:50:10 -0500

msucv gravatar image

updated 2015-12-21 05:03:13 -0500

Hi,

i use these link for installation :

1-http://rodrigoberriel.com/2014/10/installing-opencv-3-0-0-on-ubuntu-14-04/

2-http://zacg.github.io/blog/2013/05/02/installing-opencv-2-dot-4-5-on-ubuntu-12-with-eclipse-cde/

3-http://rodrigoberriel.com/2014/10/using-opencv-3-0-0-with-eclipse/

BUT i have error in eclipse when compile program.the error in console is /usr/bin/ld: cannot find -lopencv_core. how can i set /usr/bin , already i set /usr/local/lib for lib component.

full error in "eclipse console" is :

09:44:55 * Build of configuration Release for project Test * make all Building file: ../src/Test.cpp Invoking: GCC C++ Compiler g++ -I/usr/local/include/opencv2 -I/usr/local/include -I/usr/local/include/opencv -O3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/Test.d" -MT"src/Test.d" -o "src/Test.o" "../src/Test.cpp" Finished building: ../src/Test.cpp

Building target: Test Invoking: GCC C++ Linker g++ -L/usr/local/lib -o "Test" ./src/Test.o -lopencv_core\ opencv_nonfree\ opencv_imgproc\ opencv_highgui\ opencv_ml\ opencv_video\ opencv_features2d\ opencv_calib3d\ opencv_objdetect\ opencv_contrib\ opencv_legacy\ opencv_flann /usr/bin/ld: cannot find -lopencv_core opencv_nonfree opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann collect2: error: ld returned 1 exit status make: * [Test] Error 1

09:44:56 Build Finished (took 538ms)

also the error in "eclipse problem" is:

Description Resource Path Location Type cannot find -lopencv_core opencv_nonfree opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann Test C/C++ Problem

image description

image description

image description Many Thanks

edit retag flag offensive close merge delete

Comments

Did you check if the library files are present in /usr/local/lib? There should be files like libopencv_core.so. And make sure that you have read access to the files and read+execute flags for all folders.

DrCrime gravatar imageDrCrime ( 2015-12-21 03:16:22 -0500 )edit

i have access to all folder because i run eclipse with root user.also i take picture from lib folder.it is in first comment. in the eclipse console say can not find these file in /usr/bin/ld. how can sole it. Thanks

msucv gravatar imagemsucv ( 2015-12-21 03:35:54 -0500 )edit

ld is your linker. Did you check if it is installed in /usr/bin ?

$ which ld
DrCrime gravatar imageDrCrime ( 2015-12-21 03:40:37 -0500 )edit

this is "CDT build console" error in eclipse : /usr/bin/ld: cannot find -lopencv_core opencv_nonfree opencv_imgproc opencv_highgui ...

i check usr/bin folder . there is a ld file . how can i test that these component installed in ld file.which ld =/usr/bin/ld

msucv gravatar imagemsucv ( 2015-12-21 03:48:09 -0500 )edit

I don't understand your question. Your library should not be installed in the linker. Do you know what a linker is?

DrCrime gravatar imageDrCrime ( 2015-12-21 04:35:28 -0500 )edit

i mean that the ld file is /usr/bin/ld. but why can not the eclipse find opencv_core opencv_nonfree opencv_imgproc opencv_highgui.. there . how solve it. please see new picture from error in the first comment Thanks.

msucv gravatar imagemsucv ( 2015-12-21 04:44:27 -0500 )edit

It seems that you are missing a -l in front of most of your libraries

g++ -L/usr/local/lib -o "Test" ./src/Test.o  -lopencv_core -lopencv_nonfree -lopencv_imgproc -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_features2d -lopencv_calib3d -lopencv_objdetect -lopencv_contrib -lopencv_legacy -lopencv_flann

However, I don't know how to change that in eclipse.

DrCrime gravatar imageDrCrime ( 2015-12-21 04:54:21 -0500 )edit

missing in /usr/bin/ld . the files are in /usr/local/lib . and add in eclipse. i take picture from it the problem is in /usr/bin/ld.

/usr/bin/ld: cannot find -lopencv_core opencv_nonfree opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann
msucv gravatar imagemsucv ( 2015-12-21 05:01:10 -0500 )edit

The linker program ld cannot find the libraries. As I said in my previous comment: I assume that you need a -l in front of all library names. This is so if you use ld directly. However, I don't use eclipse and therefore don't know which influence it has and if it changes the syntax of ld.

DrCrime gravatar imageDrCrime ( 2015-12-21 05:59:58 -0500 )edit

I manually add lib files(opencv_core .....) from usr/local/lib to the folder usr/bin. also added these file name to eclipse one by one and no ones all of them. then every thing is ok. Thanks

msucv gravatar imagemsucv ( 2015-12-22 07:01:03 -0500 )edit