Opencv No matching function call FastFeatureDetector

I have a very simple program (that is actually taken from the book "Opencv 2 computer vision application programming cookbook) and it does not actually build. I google the problem but there is only python examples not C++ ones.

The program is

#include<vector>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
int main()
{
  cv::Mat image= cv::imread("church01.jpg",0);
  std::vector<cv::KeyPoint> keypoints;
  keypoints.clear();
  cv::FastFeatureDetector fast(40);
  fast.detect(image,keypoints);
  cv::drawKeypoints(image,keypoints,image,cv::Scalar(255,255,255),cv:DrawMatchesFlags::DRAW_OVER_OUTING);
  cv::imshow("FAST",image);
  cv::waitKey();
}

I tried to compile it with

g++ interestPoints3.cpp -o interestePoints3 `pkg-config --cflags --libs opencv opencv_features2d`  

but I get the error

No matching function for call to `cv::FastFeatureDetector::FastFeatureDetector(int)'

What can I do to solve this error? Is there some sample programs in C++ not python where I can reference from?

that was opencv 2.x, now we have 4.x and the api has changed, you need a create function to get a valid instance, like:

Ptr<FastFeatureDetector> fast = FastFeatureDetector::create(40);
fast->detect(image,keypoints);

have a look at the tutorials

Thanks!

have a look at the tutorials

Very interesting, though couldnt finr FAST there