0
votes

I am new in c++ but i need to do a project using opencv. I have downlaoded opencv-4.5.2 and opencv_contrib and I am using Visual 2019. I have used cmake and I got no error.

Then in the project I have included, the "C:\opencv\opencv_lib\install\include" directory fot the C++ additional include directories For the Linker I have included ,"C:\opencv\opencv_lib\install\x64\vc16\lib" for the additional library directories. I have included, "opencv_core452.lib,opencv_highgui452.lib,opencv_imgcodecs452.lib", int he additional dependacies. I have included, "C:...opencv\build\x64\vc14\bin" for the path.

When i run a simple project it seems that something goes wrong and I am not sure what it is. Here are the errors:

Severity Code Description Project File Line Suppression State

  1. Error LNK2019 unresolved external symbol "public: class cv::Mat & __thiscall cv::Mat::operator=(class cv::Mat &&)" (??4Mat@cv@@QAEAAV01@$$QAV01@@Z) referenced in function _main protorype C:...\protorype.obj 1
  2. Error LNK2019 unresolved external symbol "public: __thiscall cv::Mat::Mat(void)" (??0Mat@cv@@QAE@XZ) referenced in function _main protorype C:...\protorype.obj 1
  3. Error LNK2019 unresolved external symbol "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ) referenced in function _main protorype C:...\protorype.obj 1
  4. Error LNK2019 unresolved external symbol "class cv::Mat __cdecl cv::imread(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int)" (?imread@cv@@YA?AVMat@1@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function _main protorype C:...\protorype.obj 1
  5. Error LNK2019 unresolved external symbol "void __cdecl cv::namedWindow(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,int)" (?namedWindow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function _main protorype C:...\protorype.obj 1
  6. Error LNK2019 unresolved external symbol "void __cdecl cv::imshow(class std::basic_string<char,struct std::char_traits,class std::allocator > const &,class cv::debug_build_guard::_InputArray const &)" (?imshow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@ABV_InputArray@debug_build_guard@1@@Z) referenced in function _main protorype C:...\protorype.obj 1
  7. Error LNK1120 6 unresolved externals protorype C:...\protorype.exe 1

Because I am new, please explain me in simple words hwo to resolve it. Thank you in advance!

1
Please, don't flag C++ question with C tag, this is two differents languages.Ôrel
linker issues. opencv_core452.lib looks correct but make sure you specify it in the right place. this looks like that didn't work.Christoph Rackwitz
You mean in the additional dependacies?How do i do that? Also, where the libraries are I can find "opencv_core452.lib,opencv_highgui452.lib,opencv_imgcodecs452.lib" as well as this "opencv_core452d.lib,opencv_highgui452d.lib,opencv_imgcodecs452d.lib"makala
i have added all this and still get the same error:opencv_calib3d452d.lib opencv_core452d.lib opencv_features2d452d.lib opencv_flann452d.lib opencv_highgui452d.lib opencv_imgproc452d.lib opencv_ml452d.lib opencv_objdetect452d.lib opencv_photo452d.lib opencv_stitching452d.lib opencv_superres452d.lib opencv_video452d.lib opencv_videostab452d.libmakala
I have changed the machine configuration to x63 and i get only these two now: Severity Code Description Project File Line Suppression State Error LNK1120 1 unresolved externals and Severity Code Description Project File Line Suppression State Error LNK2019 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) referenced in function main protorype C:\...protorype.obj 1makala

1 Answers

0
votes

I finally found it. I dont know, probably eventhough I was using the right libraries and using the right directories as well, I decided to copy all the libraries into the dependacies and not just those that i use and it workes. Here are all the directories for my case, but note that if you are usign a different version probably they are different.

opencv_aruco452d.lib opencv_barcode452d.lib opencv_bgsegm452d.lib opencv_bioinspired452d.lib opencv_calib3d452d.lib opencv_ccalib452d.lib opencv_core452d.lib opencv_datasets452d.lib opencv_dnn_objdetect452d.lib opencv_dnn_superres452d.lib opencv_dnn452d.lib opencv_dpm452d.lib opencv_face452d.lib opencv_features2d452d.lib opencv_flann452d.lib opencv_fuzzy452d.lib opencv_gapi452d.lib opencv_hdf452d.lib opencv_hfs452d.lib opencv_highgui452d.lib opencv_img_hash452d.lib opencv_imgcodecs452d.lib opencv_imgproc452d.lib opencv_intensity_transform452d.lib opencv_line_descriptor452d.lib opencv_mcc452d.lib opencv_ml452d.lib opencv_objdetect452d.lib opencv_optflow452d.lib opencv_phase_unwrapping452d.lib opencv_photo452d.lib opencv_plot452d.lib opencv_quality452d.lib opencv_rapid452d.lib opencv_reg452d.lib opencv_rgbd452d.lib opencv_saliency452d.lib opencv_shape452d.lib opencv_stereo452d.lib opencv_stitching452d.lib opencv_structured_light452d.lib opencv_superres452d.lib opencv_surface_matching452d.lib opencv_text452d.lib opencv_tracking452d.lib opencv_video452d.lib opencv_videoio452d.lib opencv_videostab452d.lib opencv_wechat_qrcode452d.lib opencv_xfeatures2d452d.lib opencv_ximgproc452d.lib opencv_xobjdetect452d.lib opencv_xphoto452d.lib