Ask Your Question
0

Problem compiling kalman filter program

asked 2019-04-27 12:25:02 -0500

D3CIM8OR gravatar image

Hello, I am having some trouble compiling the sample kalman filter program found on https://docs.opencv.org/trunk/de/d70/...

I get the following output when I try to build the program

g++ -o  kalman kalman.o -lopencv_core -lopencv_tracking -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lopencv_videoio -lopencv_objdetect
/usr/bin/ld: kalman.o: undefined reference to symbol '_ZN2cv12KalmanFilter7predictERKNS_3MatE'
/usr/bin/ld: /usr/lib/libopencv_video.so.4.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make: *** [Makefile:9: kalman] Error 1

I am using my own Makefile for this, and this is the LIB variable in my makefile

LIBS=-lopencv_core -lopencv_tracking -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lopencv_videoio -lopencv_objdetect

And just in case, here is my entire Makefile:

CC=g++
TARGET=kalman
SRC=kalman.cpp
LIBS=-lopencv_core -lopencv_tracking -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs -lopencv_videoio -lopencv_objdetect
OBJ=kalman.o
%.o: %.cpp
        $(CC) -c -o $@ $< $(LIBS)
kalman: $(OBJ)
        $(CC) -o  $@ $^ $(LIBS)

The #includes for this program seem to suggest that the only libraries that are required to be linked are -lopencv_core, -lopencv_tracking, and -lopencv_highgui I originally had -lopencv_tracking as the very last library to link and I got the exact same error. I then promoted it to the second library to be linked and that yielded the same error.

Thanks!

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
1

answered 2019-04-27 13:18:09 -0500

berak gravatar image

updated 2019-04-27 13:20:06 -0500

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-04-27 12:25:02 -0500

Seen: 28 times

Last updated: Apr 27