0

I have created a console application with my code using opencv written in C++ in visual-studio 2012. Project was build and run Successfully. So I've decided to created a Form and tried to use this code, It is giving following error:

MLSWarpImage.obj : error LNK2028: unresolved token (0A0007F3) "public: __thiscall cv::UMat::~UMat(void)" (??1UMat@cv@@$$FQAE@XZ) referenced in function "public: __thiscall cv::HOGDescriptor::HOGDescriptor(struct cv::HOGDescriptor const &)" (??0HOGDescriptor@cv@@$$FQAE@ABU01@@Z)
1>MLSWarpImage.obj : error LNK2028: unresolved token (0A0007FA) "public: void __thiscall cv::UMat::copySize(class cv::UMat const &)" (?copySize@UMat@cv@@$$FQAEXABV12@@Z) referenced in function "public: __thiscall cv::UMat::UMat(class cv::UMat const &)" (??0UMat@cv@@$$FQAE@ABV01@@Z)
1>MLSWarpImage.obj : error LNK2028: unresolved token (0A00083F) "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@$$FYAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@$$FQAE@XZ)
1>MLSWarpImage.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@$$FYAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@$$FQAE@XZ)
1>MLSWarpImage.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::UMat::copySize(class cv::UMat const &)" (?copySize@UMat@cv@@$$FQAEXABV12@@Z) referenced in function "public: __thiscall cv::UMat::UMat(class cv::UMat const &)" (??0UMat@cv@@$$FQAE@ABV01@@Z)
1>MLSWarpImage.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::copySize(class cv::Mat const &)" (?copySize@Mat@cv@@QAEXABV12@@Z) referenced in function "public: __thiscall cv::Mat::Mat(class cv::Mat const &)" (??0Mat@cv@@QAE@ABV01@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::setSVMDetector(class cv::_InputArray const &)" (?setSVMDetector@HOGDescriptor@cv@@UAEXABV_InputArray@2@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::HOGDescriptor::read(class cv::FileNode &)" (?read@HOGDescriptor@cv@@UAE_NAAVFileNode@2@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::write(class cv::FileStorage &,class cv::String const &)const " (?write@HOGDescriptor@cv@@UBEXAAVFileStorage@2@ABVString@2@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual bool __thiscall cv::HOGDescriptor::load(class cv::String const &,class cv::String const &)" (?load@HOGDescriptor@cv@@UAE_NABVString@2@0@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::save(class cv::String const &,class cv::String const &)const " (?save@HOGDescriptor@cv@@UBEXABVString@2@0@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::copyTo(struct cv::HOGDescriptor &)const " (?copyTo@HOGDescriptor@cv@@UBEXAAU12@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::compute(class cv::_InputArray const &,class std::vector<float,class std::allocator<float> > &,class cv::Size_<int>,class cv::Size_<int>,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > const &)const " (?compute@HOGDescriptor@cv@@UBEXABV_InputArray@2@AAV?$vector@MV?$allocator@M@std@@@std@@V?$Size_@H@2@2ABV?$vector@V?$Point_@H@cv@@V?$allocator@V?$Point_@H@cv@@@std@@@5@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::detect(class cv::Mat const &,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > &,double,class cv::Size_<int>,class cv::Size_<int>,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > const &)const " (?detect@HOGDescriptor@cv@@UBEXABVMat@2@AAV?$vector@V?$Point_@H@cv@@V?$allocator@V?$Point_@H@cv@@@std@@@std@@NV?$Size_@H@2@2ABV45@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::detect(class cv::Mat const &,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > &,class std::vector<double,class std::allocator<double> > &,double,class cv::Size_<int>,class cv::Size_<int>,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > const &)const " (?detect@HOGDescriptor@cv@@UBEXABVMat@2@AAV?$vector@V?$Point_@H@cv@@V?$allocator@V?$Point_@H@cv@@@std@@@std@@AAV?$vector@NV?$allocator@N@std@@@5@NV?$Size_@H@2@3ABV45@@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::detectMultiScale(class cv::_InputArray const &,class std::vector<class cv::Rect_<int>,class std::allocator<class cv::Rect_<int> > > &,double,class cv::Size_<int>,class cv::Size_<int>,double,double,bool)const " (?detectMultiScale@HOGDescriptor@cv@@UBEXABV_InputArray@2@AAV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@NV?$Size_@H@2@2NN_N@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::detectMultiScale(class cv::_InputArray const &,class std::vector<class cv::Rect_<int>,class std::allocator<class cv::Rect_<int> > > &,class std::vector<double,class std::allocator<double> > &,double,class cv::Size_<int>,class cv::Size_<int>,double,double,bool)const " (?detectMultiScale@HOGDescriptor@cv@@UBEXABV_InputArray@2@AAV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@AAV?$vector@NV?$allocator@N@std@@@5@NV?$Size_@H@2@3NN_N@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::computeGradient(class cv::Mat const &,class cv::Mat &,class cv::Mat &,class cv::Size_<int>,class cv::Size_<int>)const " (?computeGradient@HOGDescriptor@cv@@UBEXABVMat@2@AAV32@1V?$Size_@H@2@2@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::detectROI(class cv::Mat const &,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > const &,class std::vector<class cv::Point_<int>,class std::allocator<class cv::Point_<int> > > &,class std::vector<double,class std::allocator<double> > &,double,class cv::Size_<int>,class cv::Size_<int>)const " (?detectROI@HOGDescriptor@cv@@UBEXABVMat@2@ABV?$vector@V?$Point_@H@cv@@V?$allocator@V?$Point_@H@cv@@@std@@@std@@AAV45@AAV?$vector@NV?$allocator@N@std@@@5@NV?$Size_@H@2@4@Z)
1>MLSWarpImage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall cv::HOGDescriptor::detectMultiScaleROI(class cv::Mat const &,class std::vector<class cv::Rect_<int>,class std::allocator<class cv::Rect_<int> > > &,class std::vector<struct cv::DetectionROI,class std::allocator<struct cv::DetectionROI> > &,double,int)const " (?detectMultiScaleROI@HOGDescriptor@cv@@UBEXABVMat@2@AAV?$vector@V?$Rect_@H@cv@@V?$allocator@V?$Rect_@H@cv@@@std@@@std@@AAV?$vector@UDetectionROI@cv@@V?$allocator@UDetectionROI@cv@@@std@@@5@NH@Z)
1>MLSWarpImage.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::UMat::~UMat(void)" (??1UMat@cv@@$$FQAE@XZ) referenced in function "public: __thiscall cv::HOGDescriptor::HOGDescriptor(struct cv::HOGDescriptor const &)" (??0HOGDescriptor@cv@@$$FQAE@ABU01@@Z)
1>MLSWarpImage.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" (?release@Mat@cv@@QAEXXZ)

1>C:\Users\aa\Documents\Visual Studio 2012\Projects\Project2\Release\Project2.exe : fatal error LNK1120: 22 unresolved externals

same errors I am getting when changing my console application to windows to show my output image in a window.

Is opencv can only be used in console application or any library needed to use it in gui application.

EDIT:

In Property I have included as in Console-

In Console:: Properties of console project

In Windows:: Properties of windows project

  • When you created the new project, did you remember to re-add the reference to the OpenCV library? This tells me that you added the headers via the includes directories, but that the linker did not include the library file that contains the implementations of the OpenCV functions declared in the headers. Look in the project properties, under Linker/Input, and see if the OpenCV library is visible under Additional Dependencies. – BareMetalCoder Aug 13 '18 at 14:49
  • Mind you, I'm using VS 2017 so the naming may be different. – BareMetalCoder Aug 13 '18 at 14:51
  • Looks like you forgot to link to opencv. Remember in Visual Studio changing target properties only apply to the active configuration unless you select multiple configurations for the change, – drescherjm Aug 13 '18 at 15:22

0 Answers0