Ask Your Question

first example code error

asked 2014-11-07 11:52:19 -0500

federiko00 gravatar image

updated 2014-11-09 08:36:06 -0500

berak gravatar image

hi all i've installed opencv version 3 from github....but when i try to do the first example code using Eclipse ( the code line way works well) i obtain this error and i don't know what to do. Thank you for your help

18:42:03 * Incremental Build of configuration Debug for project DI * make all Building file: ../src/DI.cpp Invoking: GCC C++ Compiler g++ -I/usr/local/include/opencv -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"src/DI.d" -MT"src/DI.d" -o "src/DI.o" "../src/DI.cpp" Finished building: ../src/DI.cpp

Building target: DI Invoking: GCC C++ Linker g++ -L/usr/local/lib -o "DI" ./src/DI.o -lopencv_core -lopencv_imgproc -lopencv_highgui /usr/bin/ld: ./src/DI.o: undefined reference to symbol '_ZN2cv6imreadERKNS_6StringEi' //usr/local/lib/ error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status make: * [DI] Errore 1

18:42:03 Build Finished (took 763ms)

edit retag flag offensive close merge delete


I don't know how to solve this in particular, but I think these problems can be avoided if you follow these tutorials:

This worked for a lot of people, I hope this help you.

Rodrigo Berriel gravatar imageRodrigo Berriel ( 2014-11-07 13:43:16 -0500 )edit

i exactly followed tutorials on opencv doc for opencv 3.0 and i get this problem

federiko00 gravatar imagefederiko00 ( 2014-11-10 04:16:00 -0500 )edit

just to say: those tutorials I recommended have the same recomendation @berak did

Rodrigo Berriel gravatar imageRodrigo Berriel ( 2014-11-13 10:01:21 -0500 )edit

@Mohsen Shafaghi

please do not post answers here, if you have a question or a comment, thank you.

(and no, this is not how this site works, noone will send you anything per mail, please do not expect anything like this)

berak gravatar imageberak ( 2019-04-17 02:25:03 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-11-09 08:35:20 -0500

berak gravatar image

updated 2014-11-09 08:37:40 -0500

imread/imwrite and friends were moved from highgui to a new imgcodecs module.

so you will have to

#include "opencv2/imgcodecs.hpp"

and link


btw, include path should be:



edit flag offensive delete link more


perfect! this works! i would be useful if these correction steps were added to the official opencv 3.0 pages tutorial!

federiko00 gravatar imagefederiko00 ( 2014-11-10 04:17:40 -0500 )edit

frederiko00 , if you could point out errors/misleading parts in the tutorials, that would be definitely helpful to others !

berak gravatar imageberak ( 2014-11-10 04:34:10 -0500 )edit

Really Great!!!Thanks for the answer;solved my issue too.As I am a beginner I was unaware of these changes.

Blue_Gene gravatar imageBlue_Gene ( 2015-05-01 16:01:47 -0500 )edit

Thanks, This Worked perfectly for me

vikrammeena gravatar imagevikrammeena ( 2015-12-29 13:41:59 -0500 )edit

So, am I reading this correctly? 18 months ago this problem and solution was posted. To date the tutorial has _still_ not been edited to reflect these updates. It makes it hard for us to convince the "pointy-haired boss" that linux/openCV is the proper approach when he gets error after error when following the tutorials verbatim.

TyWebb gravatar imageTyWebb ( 2016-05-15 13:46:56 -0500 )edit

One year later and I just desperately copy pasted this very obscure error message into google, ended up here and lo and behold, the solution was right here. Thank you so much! A bit daunting when you try to learn something new and I end up spending hours discerning outdated installation instructions. Thanks again for the help!

MC Squidzy gravatar imageMC Squidzy ( 2017-07-17 09:34:08 -0500 )edit

@MC Squidzy spammer?

LBerger gravatar imageLBerger ( 2017-07-17 09:37:07 -0500 )edit

@LBerger, unsure.

berak gravatar imageberak ( 2017-07-17 09:39:02 -0500 )edit

Question Tools


Asked: 2014-11-07 11:52:19 -0500

Seen: 28,767 times

Last updated: Nov 09 '14