Windows C++ API - unresolved external symbol


#1

I am trying to make the “cpp-sdk-samples” from GitHub work. I am using VC2017 and installed the dependencies that required (including opencv 2.4.11) but when I try to build the project (only the “video-demo” part) I get those errors:

1>video-demo.obj : error LNK2001: 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@@YAXAEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@AEBV_InputArray@1@@Z)
1>video-demo.obj : error LNK2001: unresolved external symbol "int __cdecl cv::_interlockedExchangeAdd(int *,int)" (?_interlockedExchangeAdd@cv@@YAHPEAHH@Z)
1>video-demo.obj : error LNK2001: unresolved external symbol "public: void __cdecl cv::Mat::copySize(class cv::Mat const &)" (?copySize@Mat@cv@@QEAAXAEBV12@@Z)
1>video-demo.obj : error LNK2001: unresolved external symbol "public: void __cdecl cv::Mat::deallocate(void)" (?deallocate@Mat@cv@@QEAAXXZ)
1>video-demo.obj : error LNK2001: 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@@YAXAEAVMat@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@V?$Point_@H@1@HNV?$Scalar_@N@1@HH_N@Z)
1>video-demo.obj : error LNK2001: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPEAX@Z)
1>video-demo.obj : error LNK2001: unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?imread@cv@@YA?AVMat@1@AEBV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z)
1>video-demo.obj : error LNK2001: unresolved external symbol "public: __cdecl cv::_InputArray::_InputArray(class cv::Mat const &)" (??0_InputArray@cv@@QEAA@AEBVMat@1@@Z)
1>video-demo.obj : error LNK2001: unresolved external symbol "int __cdecl cv::waitKey(int)" (?waitKey@cv@@YAHH@Z)
1>video-demo.obj : error LNK2001: 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@@YAXAEAVMat@1@V?$Point_@H@1@HAEBV?$Scalar_@N@1@HHH@Z)`Preformatted text`

does anyone have any idea how can I solve it?


#2

You should link to OpenCV library to resolve this issue

#pragma comment(lib, "opencv_world310d.lib")

If I remember correctly that’s the library that you should be linking to


#3

@omer_ben_chetrit was this resolved?


#4