C++ 链接库以及动态库相关报错解决
环境:
VS2015 + c++11 + opencv3.4.3GPU
项目场景:
使用opencv3.4.3GPU for C++实现多目标跟踪问题描述1:
在进行编译时,提示如下:1>main.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::rectangle(class cv::Mat &,class cv::Rect_<int>,class cv::Scalar_<double> const &,int,int,int)" (?rectangle@cv@@YAXAEAVMat@1@V?$Rect_@H@1@AEBV?$Scalar_@N@1@HHH@Z),该符号在函数 main 中被引用
1>main.obj : error LNK2019: 无法解析的外部符号 "void __cdecl cv::putText(class cv::debug_build_guard::_InputOutputArray const &,class cv::String const &,class cv::Point_<int>,int,double,class cv::Scalar_<double>,int,int,bool)" (?putText@cv@@YAXAEBV_InputOutputArray@debug_build_guard@1@AEBVString@1@V?$Point_@H@1@HNV?$Scalar_@N@1@HH_N@Z),该符号在函数 main 中被引用
原因分析1:
解决方案的配置中,缺少相关的lib库文件。解决方案1:
在链接器->输入中添加相关库。根据提示中的API查找对应的lib文件,可以通过查询函数在哪个头文件中,然后通过头文件查找对应的lib库,并进行添加。