0

i am new to visual studio fro C++, and i followed a visual tutorial to learn how to import opeCV librar into mircrosoft visual studio, after i followed the tutorial i tried to build the code and i received the below posted errors.

build Errors:

1>drawing.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::_InputArray::_InputArray(class cv::Mat const &)" (??0_InputArray@cv@@QAE@ABVMat@1@@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "public: static class cv::MatExpr __cdecl cv::Mat::zeros(int,int,int)" (?zeros@Mat@cv@@SA?AVMatExpr@2@HHH@Z) referenced in function _main
1>drawing.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>drawing.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>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::line(class cv::Mat &,class cv::Point_<int>,class cv::Point_<int>,class cv::Scalar_<double> const &,int,int,int)" (?line@cv@@YAXAAVMat@1@V?$Point_@H@1@1ABV?$Scalar_@N@1@HHH@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::rectangle(class cv::Mat &,class cv::Point_<int>,class cv::Point_<int>,class cv::Scalar_<double> const &,int,int,int)" (?rectangle@cv@@YAXAAVMat@1@V?$Point_@H@1@1ABV?$Scalar_@N@1@HHH@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::circle(class cv::Mat &,class cv::Point_<int>,int,class cv::Scalar_<double> const &,int,int,int)" (?circle@cv@@YAXAAVMat@1@V?$Point_@H@1@HABV?$Scalar_@N@1@HHH@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::ellipse(class cv::Mat &,class cv::Point_<int>,class cv::Size_<int>,double,double,double,class cv::Scalar_<double> const &,int,int,int)" (?ellipse@cv@@YAXAAVMat@1@V?$Point_@H@1@V?$Size_@H@1@NNNABV?$Scalar_@N@1@HHH@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fillPoly(class cv::Mat &,class cv::Point_<int> const * *,int const *,int,class cv::Scalar_<double> const &,int,int,class cv::Point_<int>)" (?fillPoly@cv@@YAXAAVMat@1@PAPBV?$Point_@H@1@PBHHABV?$Scalar_@N@1@HHV31@@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::polylines(class cv::Mat &,class cv::Point_<int> const * *,int const *,int,bool,class cv::Scalar_<double> const &,int,int,int)" (?polylines@cv@@YAXAAVMat@1@PAPBV?$Point_@H@1@PBHH_NABV?$Scalar_@N@1@HHH@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::putText(class cv::Mat &,class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::Point_<int>,int,double,class cv::Scalar_<double>,int,int,bool)" (?putText@cv@@YAXAAVMat@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$Point_@H@1@HNV?$Scalar_@N@1@HH_N@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "class cv::Size_<int> __cdecl cv::getTextSize(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int,double,int,int *)" (?getTextSize@cv@@YA?AV?$Size_@H@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@HNHPAH@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "int __cdecl cv::_interlockedExchangeAdd(int *,int)" (?_interlockedExchangeAdd@cv@@YAHPAHH@Z) referenced in function "public: __thiscall cv::Mat::Mat(class cv::Mat const &)" (??0Mat@cv@@QAE@ABV01@@Z)
1>drawing.obj : error LNK2019: unresolved external symbol "class cv::MatExpr __cdecl cv::operator-(class cv::Mat const &,class cv::Scalar_<double> const &)" (??Gcv@@YA?AVMatExpr@0@ABVMat@0@ABV?$Scalar_@N@0@@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z) referenced in function _main
1>drawing.obj : error LNK2019: unresolved external symbol "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,class cv::_InputArray const &)" (?imshow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@1@@Z) referenced in function _main
1>c:\users\abakri\documents\visual studio 2013\Projects\OpenCV_App_00\Debug\OpenCV_App_00.exe : fatal error LNK1120: 17 unresolved externals

please let me know how to solve it.

Amrmsmb
  • 1
  • 27
  • 104
  • 226
  • Looks like you're not including the cv library at *link stage*. Add the `lib` to your "additional library dependencies" via project settings. – Bathsheba Mar 23 '15 at 10:16
  • @Bathsheba please tell me how to do so – Amrmsmb Mar 23 '15 at 10:16
  • Right click on your project -> Properties -> Linker -> Input. Add the name of the library to input. Then go to project -> Properties -> VC++ Directories and add the path to the library to Library Directories. – Robinson Mar 23 '15 at 10:21
  • and add libs like `opencv_core300.lib` (or whichever opencv version you use) to "input" in the linker settings – Micka Mar 23 '15 at 10:26
  • @Micka the folder that contains the libs have many libs, and the item 'input' of the linker doesnt allow to select the libs you have to copy and paste the name of the whole libs contained and they are too much...is there any other way to specify all the libs in the 'input' – Amrmsmb Mar 23 '15 at 10:32
  • not as far as i know... just add the relevant ones first: opencv_coreXXX.lib, opencv_highguiXXX.lib opencv_imageproc should be a good start. Important: if you are compiling in debug mode use the debug libraries with a `d` before the dot. opencv_moduleXXXd.lib and the ones without the d if you compile in release mode (very important!) – Micka Mar 23 '15 at 10:37
  • @Micka now i receive: Link : fatal error Link1104: cant open file opencv_core2410.obj – Amrmsmb Mar 23 '15 at 11:07
  • did you add `.lib` at the end of the lib name? – Micka Mar 23 '15 at 11:32
  • @Micka now i added the the extension .lib, but i still receive the same error – Amrmsmb Mar 23 '15 at 11:50
  • @Micka also the "opencv_core2410" is not existing, and i am using version 2.4.11 not 2.4.19 – Amrmsmb Mar 23 '15 at 12:01
  • have a look at your opencv directory how the files are named... probably opencv_core2411.lib – Micka Mar 23 '15 at 12:30

0 Answers0