0

I am trying to run the sample k-nearest classifier code from: http://docs.opencv.org/2.4/modules/ml/doc/k_nearest_neighbors.html I have included these headers:

#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/ml/ml.hpp"

I am getting the following error:

unresolved external symbol "public: virtual float __cdecl CvKNearest::find_nearest(struct CvMat const *,int,struct CvMat *,float const * *,struct CvMat *,struct CvMat *)const " (?find_nearest@CvKNearest@@UEBAMPEBUCvMat@@HPEAU2@PEAPEBM11@Z)

Any help resolving this would be much appreciated.

Rama
  • 3,222
  • 2
  • 11
  • 26
NEA
  • 1
  • 1
    How are you compiling the code? Post the command that you are running or your make file – Rama Jan 17 '17 at 20:40
  • You included the headers, but did you also specify the libraries to the linker? – user4581301 Jan 17 '17 at 20:45
  • Thank you. I realized that I have to add the opencv_ml.lib in the Additional Dependencies under Linker-> Input->. – NEA Jan 18 '17 at 19:00

0 Answers0