Ask Your Question
0

Ubuntu/Eclipse CDT Tutorial Build Errors

asked 2015-12-06 01:35:01 -0600

JohnBabrick gravatar image

updated 2015-12-06 07:52:24 -0600

I am working through installing OpenCV on Ubuntu 15.10 following the OpenCV Tutorial at

http://docs.opencv.org/3.0-last-rst/d...

and I am running into include and library linking errors. For the include errors, I find that I need to explicitly include from the opencv2 directories. But, the problem arises that I cannot link. Please take a look at the screenshots of the link error and of the project properties window. Any help would be greatly appreciated.

In case you can't read the link error in the screenshot, it is:

02:10:26 **** Incremental Build of configuration Release for project DisplayImage ****

make all Building target: DisplayImage Invoking: GCC C++ Linker g++ -L/usr/local/lib -o "DisplayImage" ./src/DisplayImage.o -lopencv_core -lopencv_imgproc -lopencv_highgui /usr/bin/ld: ./src/DisplayImage.o: undefined reference to symbol '_ZN2cv6imreadERKNS_6StringEi' makefile:45: recipe for target 'DisplayImage' failed /usr/local/lib/libopencv_imgcodecs.so.3.0: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: * [DisplayImage] Error 1

02:10:26 Build Finished (took 114ms)

image description

image description

UPDATE: (Answer, but I cannot submit my own answer yet. Here are the two screenshots of what the source code should look like and what the library settings should be. )

image description

image description

image description

edit retag flag offensive close merge delete

Comments

1

as the error says, you need to add -lopencv_imcodecs to your linker cmdline

berak gravatar imageberak ( 2015-12-06 02:09:59 -0600 )edit
1

Please, don't include *_c.h header files, use .hpp header files instead. For that example, you only need opencv2/core.hpp and opencv2/highgui.hpp

LorenaGdL gravatar imageLorenaGdL ( 2015-12-06 02:11:52 -0600 )edit

Yes, I figured that out some time after I posted the question. However, the tutorial is missing that one library in the list of libraries to include. Perhaps someone could update the tutorial? it is otherwise quite helpful.

From the tutorial, the list of libraries to add to the search are

opencv_core opencv_imgproc opencv_highgui opencv_ml opencv_video opencv_features2d opencv_calib3d opencv_objdetect opencv_contrib opencv_legacy opencv_flann

JohnBabrick gravatar imageJohnBabrick ( 2015-12-06 02:22:31 -0600 )edit
1

yes, you're right, the tutorial still shows the outdated 2.4 library list.

for opencv3, it will need removing opencv_legacyand opencv_contrib, and adding opencv_imcodecs and opencv_videoio

(if you could come up with more accurate screenshots, we could try to update the tutorial ;)

berak gravatar imageberak ( 2015-12-06 03:07:19 -0600 )edit
1

I am going to attempt to add the two screenshots as an edit to the original question - I can't add them here. I also cannot answer my own question for another two days, the website tells me. If you want to, write your response as an answer to the question.

JohnBabrick gravatar imageJohnBabrick ( 2015-12-06 07:47:05 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

answered 2015-12-10 12:53:14 -0600

JohnBabrick gravatar image

As "berak" notes, the answer is to add the opencv_imcodecs library to the list of libraries defined in eclipse. Also, the tutorial needs to be updated for the new code as noted in the comments.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2015-12-06 01:21:12 -0600

Seen: 1,258 times

Last updated: Dec 10 '15