Reputation: 11
I need help with my face recognition program. I got these errors when I build my program:
error LNK2019: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class std::vector<float,class std::allocator<float> > const &)" (?setSVMDetector@HOGDescriptor@cv@@UAEXABV?$vector@MV?$allocator@M@std@@@std@@@Z) referenced in function "int __cdecl ppledetect(void)" (?ppledetect@@YAHXZ)
error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::write(class cv::FileStorage &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)const " (?write@HOGDescriptor@cv@@UBEXAAVFileStorage@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z)
error LNK1120: 11 unresolved externals
I got 11 these kinds of errors. 3 of error LNK2019 while 8 of error LNK2001 and 1 of error LNK1120. Why is this happening?
Upvotes: 0
Views: 1776
Reputation: 11
I got same error and I resolved by previous answers.
If you're using Visual Studio: go to Project properties -> Configuration properties -> Linker -> Input -> Additional Dependencies and edit it. You need to add "opencv_objdetect249d.lib" (I am using opencv 2.4.9 but your file name can be different, 249 can change. Look your ..\opencv\build\x64\vc10\lib directory and write your file's name: opencv_objdetect???d.lib)
Upvotes: 0
Reputation: 14051
The errors mean that OpenCV is not linked correctly. Make sure you follow the instructions at http://opencv.willowgarage.com/wiki/VisualC%2B%2B.
Upvotes: 0
Reputation: 30725
This usually means you are missing linker dependencies (lib files)
A search shows these files you will need to add in debug:
opencv_core220d.lib
opencv_highgui220d.lib
opencv_video220d.lib
opencv_ml220d.lib
opencv_legacy220d.lib
opencv_imgproc220d.lib
If you're using Visual Studio, you can go to :
project properties -> Configuration properties -> Linker -> General
From there, set the "Additional Library Directories". This is where you enter the root directory where the lib files are located. eg: C:\program files\opencv22\lib\
You then need to go to project properties -> Configuration properties -> Linker -> Input
Under Additional Dependencies, you need to add those lib files there.
Upvotes: 1