由于未解析的外部因素,OpenCV将无法编译 - LNK2019

时间:2012-05-06 16:56:39

标签: c++ visual-studio-2010 opencv unresolved-external lnk2019

我是OpenCV的新手,并一直试图在Visual Studios 2010 Ultimate中进行设置。我完全按照文档,并按照它说的链接文件。以下是我正在使用的其他库:

opencv_core231d.lib
opencv_imgproc231d.lib
opencv_highgui231d.lib
opencv_ml231d.lib
opencv_video231d.lib
opencv_features2d231d.lib
opencv_calib3d231d.lib
opencv_objdetect231d.lib
opencv_contrib231d.lib
opencv_legacy231d.lib
opencv_flann231d.lib

以及他们所有的Release版本。但是,当我尝试调试&编译给我的示例代码,我得到以下错误。 (我在某处读到你必须编译和发布项目以使其正常工作?这也是正确的吗?)

1>------ Build started: Project: openCVTest, Configuration: Debug Win32 ------
1>Build started 5/6/2012 10:39:03 AM.
1>InitializeBuildStatus:
1>  Touching "Debug\openCVTest.unsuccessfulbuild".
1>ClCompile:
1>  All outputs are up-to-date.
1>ManifestResourceCompile:
1>  All outputs are up-to-date.
1>openCVTest.obj : error LNK2019: unresolved external symbol _cvWaitKey referenced in function _main
1>openCVTest.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>openCVTest.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>openCVTest.obj : error LNK2019: unresolved external symbol _cvMoveWindow referenced in function _main
1>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::namedWindow(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &,int)" (?namedWindow@cv@@YAXABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@H@Z) referenced in function _main
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: virtual double __thiscall cv::VideoCapture::get(int)" (?get@VideoCapture@cv@@UAENH@Z) referenced in function _main
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::VideoCapture::~VideoCapture(void)" (??1VideoCapture@cv@@UAE@XZ) referenced in function _main
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::isOpened(void)const " (?isOpened@VideoCapture@cv@@UBE_NXZ) referenced in function _main
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::VideoCapture::VideoCapture(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (??0VideoCapture@cv@@QAE@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _main
1>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" (?fastFree@cv@@YAXPAX@Z) referenced in function "public: __thiscall cv::Mat::~Mat(void)" (??1Mat@cv@@QAE@XZ)
1>openCVTest.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>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::Scalar_<double> __cdecl cv::sum(class cv::_InputArray const &)" (?sum@cv@@YA?AV?$Scalar_@N@1@ABV_InputArray@1@@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" (?getPSNR@@YANABVMat@cv@@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: class cv::MatExpr __thiscall cv::Mat::mul(class cv::_InputArray const &,double)const " (?mul@Mat@cv@@QBE?AVMatExpr@2@ABV_InputArray@2@N@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" (?getPSNR@@YANABVMat@cv@@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::convertTo(class cv::_OutputArray const &,int,double,double)const " (?convertTo@Mat@cv@@QBEXABV_OutputArray@2@HNN@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" (?getPSNR@@YANABVMat@cv@@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::absdiff(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &)" (?absdiff@cv@@YAXABV_InputArray@1@0ABV_OutputArray@1@@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" (?getPSNR@@YANABVMat@cv@@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::_OutputArray::_OutputArray(class cv::Mat &)" (??0_OutputArray@cv@@QAE@AAVMat@1@@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" (?getPSNR@@YANABVMat@cv@@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::Scalar_<double> __cdecl cv::mean(class cv::_InputArray const &,class cv::_InputArray const &)" (?mean@cv@@YA?AV?$Scalar_@N@1@ABV_InputArray@1@0@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" (?getMSSIM@@YA?AV?$Scalar_@N@cv@@ABVMat@2@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::_OutputArray const & __cdecl cv::noArray(void)" (?noArray@cv@@YAABV_OutputArray@1@XZ) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" (?getMSSIM@@YA?AV?$Scalar_@N@cv@@ABVMat@2@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::divide(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,double,int)" (?divide@cv@@YAXABV_InputArray@1@0ABV_OutputArray@1@NH@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" (?getMSSIM@@YA?AV?$Scalar_@N@cv@@ABVMat@2@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::MatExpr __cdecl cv::operator+(class cv::Mat const &,class cv::Mat const &)" (??Hcv@@YA?AVMatExpr@0@ABVMat@0@0@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" (?getMSSIM@@YA?AV?$Scalar_@N@cv@@ABVMat@2@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::MatExpr __cdecl cv::operator+(class cv::MatExpr const &,class cv::Scalar_<double> const &)" (??Hcv@@YA?AVMatExpr@0@ABV10@ABV?$Scalar_@N@0@@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" (?getMSSIM@@YA?AV?$Scalar_@N@cv@@ABVMat@2@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::MatExpr __cdecl cv::operator*(double,class cv::Mat const &)" (??Dcv@@YA?AVMatExpr@0@NABVMat@0@@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" (?getMSSIM@@YA?AV?$Scalar_@N@cv@@ABVMat@2@0@Z)
1>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::GaussianBlur(class cv::_InputArray const &,class cv::_OutputArray const &,class cv::Size_<int>,double,double,int)" (?GaussianBlur@cv@@YAXABV_InputArray@1@ABV_OutputArray@1@V?$Size_@H@1@NNH@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" (?getMSSIM@@YA?AV?$Scalar_@N@cv@@ABVMat@2@0@Z)
1>openCVTest.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>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::subtract(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &,class cv::_InputArray const &,int)" (?subtract@cv@@YAXABV_InputArray@1@0ABV_OutputArray@1@0H@Z) referenced in function "class cv::Mat & __cdecl cv::operator-=(class cv::Mat const &,class cv::Mat const &)" (??Zcv@@YAAAVMat@0@ABV10@0@Z)
1>C:\Users\Logan\documents\visual studio 2010\Projects\openCVTest\Debug\openCVTest.exe : fatal error LNK1120: 25 unresolved externals
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.40
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

我浏览了所有目录并确保实际上存在于我的OpenCV文件中的库,并且我的下载没有损坏或任何其他内容。任何帮助将不胜感激!

-Logantf17

2 个答案:

答案 0 :(得分:7)

我遇到了同样的问题,发现我的目标是32位平台。答案是将我的项目更改为目标x64。说明位于:http://msdn.microsoft.com/en-us/library/vstudio/ms185328.aspx

我还发现chaiy上面列出的参考文献非常有用。这是:http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to

答案 1 :(得分:4)

<{3}}中的shambool只是指出你应该阅读another thread