Ask Your Question
0

I am building a program that uses openCV on a raspberry pi. I am gettng during linking relating to missing symbols. How do I fix them?

asked 2018-09-23 10:52:40 -0600

Pranav Lal gravatar image

updated 2018-09-23 11:18:37 -0600

I am trying to build a program on my raspberry pi running raspbian strech. I am getting missing symbols errors when building with opencv. ^
/usr/bin/ld: /tmp/ccY2H1tz.o: undefined reference to symbol '_ZN2cv12VideoCapture3setEid'
//usr/local/lib/libopencv_videoio.so.3.4: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

pi@raspberrypi:~ $ pkg-config --modversion opencv
3.4.1

The commandline I am using to build my program is: g++ -I /usr/include -O3 hificode_OpenCV.cpp -o vl01.bin -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lopencv_core

However, when I run: pi@raspberrypi:~ $ pkg-config --cflags opencv
I get: -I/usr/local/include/opencv -I/usr/local/include

Having said the above, I am not getting any errors about missing header files. The files I am including in my code are:

include <stdio.h>

include <stdlib.h>

include <math.h>

include "opencv2/imgproc/imgproc.hpp"

include "opencv2/highgui/highgui.hpp"

include <opencv2 imgcodecs.hpp="">

How do I fix the missing symbols error during linking? Pranav

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2018-09-24 05:44:17 -0600

berak gravatar image

updated 2018-09-24 05:46:08 -0600

if you want to use the VideoCapture class, you have to include:

include "opencv2/videoio.hpp"

and link:

-lopencv_videoio

(in 2.4 all of it was in highgui, but that was changed with 3.0)

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-09-23 10:51:34 -0600

Seen: 346 times

Last updated: Sep 24 '18