Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

undefined reference to `cv::xfeatures2d::SURF::create(double, int, int, bool, bool)'

Hi,

I have updated OpenCV c++ recently from 3.1 to 3.2 version and getting next error while compile:

undefined reference to `cv::xfeatures2d::SURF::create(double, int, int, bool, bool)'

My cmake file:

cmake_minimum_required(VERSION 3.6)
project(OpenCVProject)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_FLAGS "-O3")
find_package(OpenCV REQUIRED)
set(SOURCE_FILES main.cpp SurfDetector.cpp SurfDetector.h ContoursDetector.cpp ContoursDetector.h)
add_executable(OpenCVProject ${SOURCE_FILES})
target_link_libraries(OpenCVProject ${OpenCV_LIBS})

And my header file is:

#include <stdio.h>
#include <iostream>
#include <opencv2/imgproc.hpp>
#include "opencv2/features2d/features2d.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/calib3d/calib3d.hpp"
#include "opencv2/xfeatures2d.hpp"

using namespace cv;
using namespace std;
using namespace cv::xfeatures2d;

Code snippet that cause the error:

Ptr<SURF> detector = SURF::create(400, 4, 3, true, true);

I compiled OpenCV from source, but previously I compiled opencv-contrib library following instruction in their readmy, exactly the way I did for version 3.1.

The question is there a bug or changes in 3.2 that I am not aware of?

Thanks in advance.