mercredi 18 avril 2018

OpenCV linking error by using `cv::cvtColor`

I am getting this error:

usr/bin/ld: CMakeFiles/stereo_img.dir/stereo_img.cpp.o: undefined reference to symbol '_ZN2cv8cvtColorERKNS_11_InputArrayERKNS_12_OutputArrayEii'
//usr/lib/x86_64-linux-gnu/libopencv_imgproc.so.2.4: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

In my CmakeLists.txt I added:

add_definitions(-lopencv_core -lopencv_imgproc -lopencv_highgui -lopencv_nonfree -lopencv_objdetect -lopencv_features2d )

I am using these includes:

#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>

I can use other types from opencv, such as cv::Mat.

Aucun commentaire:

Enregistrer un commentaire