Unable to load my first opencv file

asked 2016-02-29 08:40:43 -0500

Bushra gravatar image

updated 2016-02-29 09:32:27 -0500

kbarni gravatar image
 $ g++ `pkg-config --libs --cflags opencv` -o cv2 cv2.cpp

/tmp/ccuiICVX.o: In function `main':
cv2.cpp:(.text+0x23): undefined reference to `cvLoadImage'
cv2.cpp:(.text+0x36): undefined reference to `cvNamedWindow'
cv2.cpp:(.text+0x47): undefined reference to `cvShowImage'
cv2.cpp:(.text+0x51): undefined reference to `cvWaitKey'
cv2.cpp:(.text+0x5d): undefined reference to `cvReleaseImage'
cv2.cpp:(.text+0x67): undefined reference to `cvDestroyWindow'
collect2: error: ld returned 1 exit status

Can anyone please help me to fix this problem?

edit retag flag offensive close merge delete

Comments

you forgot to link some opencv libs. which opencv version is it ?

what does pkg-config --libs opencv print out ?

berak gravatar imageberak ( 2016-02-29 08:52:25 -0500 )edit