Reputation: 1493
I'm using Eclipse and OpenCV (Version 3) on Ubuntu 15.10 to write a C program but I don't get why I'm always getting the error
undefined reference to symbol 'cvSaveImage'
If I run
pkg-config opencv --cflags --libs
I get
-I/usr/local/include/opencv -I/usr/local/include -L/usr/local/lib
-lopencv_shape -lopencv_stitching -lopencv_objdetect -lopencv_superres
-lopencv_videostab -lopencv_calib3d -lopencv_features2d
-lopencv_highgui -lopencv_videoio -lopencv_imgcodecs -lopencv_video
-lopencv_photo -lopencv_ml -lopencv_imgproc -lopencv_flann
-lopencv_core -lopencv_hal
So I added the LIbraries to the GCC C Liker as in the image below
If I don't try to use the function cvSaveImage the program runs, so the other libraries correctly work. I included the highgui library:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <stdbool.h>
#include <time.h>
Any idea?
Upvotes: 0
Views: 890
Reputation: 13601
cvSaveImage
belongs to opencv_imgcodecs.
You are missing opencv_imgcodecs
in the libraries (-l).
Upvotes: 1