程式語言 - OpenCV - 解決OpenCVHelper.obj : error LNK2019: unresolved external symbol void __cdecl cv::GaussianBlur問題



問題如下:

OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::GaussianBlur(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,class cv::Size_<int>,double,double,int)" (?GaussianBlur@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@V?$Size_@H@1@NNH@Z) referenced in function "public: long __cdecl OpenCVHelper::ApplyColorFilter(class cv::Mat *)" (?ApplyColorFilter@OpenCVHelper@@QEAAJPEAVMat@cv@@@Z)
OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::blur(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,class cv::Size_<int>,class cv::Point_<int>,int)" (?blur@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@V?$Size_@H@1@V?$Point_@H@1@H@Z) referenced in function "public: long __cdecl OpenCVHelper::ApplyColorFilter(class cv::Mat *)" (?ApplyColorFilter@OpenCVHelper@@QEAAJPEAVMat@cv@@@Z)
OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::Canny(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,double,double,int,bool)" (?Canny@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@NNH_N@Z) referenced in function "public: long __cdecl OpenCVHelper::ApplyColorFilter(class cv::Mat *)" (?ApplyColorFilter@OpenCVHelper@@QEAAJPEAVMat@cv@@@Z)
OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::erode(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,class cv::debug_build_guard::_InputArray const &,class cv::Point_<int>,int,int,class cv::Scalar_<double> const &)" (?erode@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@0V?$Point_@H@1@HHAEBV?$Scalar_@N@1@@Z) referenced in function "public: long __cdecl OpenCVHelper::ApplyColorFilter(class cv::Mat *)" (?ApplyColorFilter@OpenCVHelper@@QEAAJPEAVMat@cv@@@Z)
OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::dilate(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,class cv::debug_build_guard::_InputArray const &,class cv::Point_<int>,int,int,class cv::Scalar_<double> const &)" (?dilate@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@0V?$Point_@H@1@HHAEBV?$Scalar_@N@1@@Z) referenced in function "public: long __cdecl OpenCVHelper::ApplyColorFilter(class cv::Mat *)" (?ApplyColorFilter@OpenCVHelper@@QEAAJPEAVMat@cv@@@Z)
OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::cvtColor(class cv::debug_build_guard::_InputArray const &,class cv::debug_build_guard::_OutputArray const &,int,int)" (?cvtColor@cv@@YAXAEBV_InputArray@debug_build_guard@1@AEBV_OutputArray@31@HH@Z) referenced in function "public: long __cdecl OpenCVHelper::ApplyColorFilter(class cv::Mat *)" (?ApplyColorFilter@OpenCVHelper@@QEAAJPEAVMat@cv@@@Z)
OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::line(class cv::debug_build_guard::_InputOutputArray const &,class cv::Point_<int>,class cv::Point_<int>,class cv::Scalar_<double> const &,int,int,int)" (?line@cv@@YAXAEBV_InputOutputArray@debug_build_guard@1@V?$Point_@H@1@1AEBV?$Scalar_@N@1@HHH@Z) referenced in function "private: void __cdecl OpenCVHelper::DrawBone(class cv::Mat *,struct _NUI_SKELETON_DATA *,enum _NUI_SKELETON_POSITION_INDEX,enum _NUI_SKELETON_POSITION_INDEX,class cv::Point_<int> * const,class cv::Scalar_<double>)" (?DrawBone@OpenCVHelper@@AEAAXPEAVMat@cv@@PEAU_NUI_SKELETON_DATA@@W4_NUI_SKELETON_POSITION_INDEX@@2QEAV?$Point_@H@3@V?$Scalar_@N@3@@Z)
OpenCVHelper.obj : error LNK2019: unresolved external symbol "void __cdecl cv::circle(class cv::debug_build_guard::_InputOutputArray const &,class cv::Point_<int>,int,class cv::Scalar_<double> const &,int,int,int)" (?circle@cv@@YAXAEBV_InputOutputArray@debug_build_guard@1@V?$Point_@H@1@HAEBV?$Scalar_@N@1@HHH@Z) referenced in function "private: void __cdecl OpenCVHelper::DrawSkeleton(class cv::Mat *,struct _NUI_SKELETON_DATA *,class cv::Scalar_<double>,enum _NUI_IMAGE_RESOLUTION,enum _NUI_IMAGE_RESOLUTION)" (?DrawSkeleton@OpenCVHelper@@AEAAXPEAVMat@cv@@PEAU_NUI_SKELETON_DATA@@V?$Scalar_@N@3@W4_NUI_IMAGE_RESOLUTION@@3@Z)
C:\Users\Administrator\Desktop\d2d\x64\Debug\KinectBridgeWithOpenCVBasics-D2D.exe : fatal error LNK1120: 9 unresolved externals

解法如下:
專案如果是debug則需要把LIB改成對應的版本,如:opencv_worldxxxd.lib,而選擇release時,則需要使用release對應的版本,如:opencv_worldxxx.lib