2012-05-06 35 views
8

Tôi là người mới sử dụng OpenCV và đã cố gắng thiết lập nó trong Visual Studio 2010 Ultimate. Tôi đã theo dõi tài liệu chính xác và liên kết các tệp như đã nói. Dưới đây là các thư viện bổ sung mà tôi đang sử dụng:OpenCV sẽ không biên dịch do bên ngoài chưa được giải quyết - LNK2019

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 

Và tất cả các đối tác phát hành của chúng. Tuy nhiên, khi tôi cố gắng gỡ lỗi & biên dịch mã mẫu cho tôi, tôi nhận được các lỗi sau. (Tôi đọc ở đâu đó rằng bạn cần phải biên dịch và xuất bản dự án để cho nó hoạt động đúng cách? Is that true cũng?)

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 &)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) referenced in function _main 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::_InputArray::_InputArray(class cv::Mat const &)" ([email protected]@@[email protected]@[email protected]@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)" ([email protected]@@[email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function _main 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: virtual double __thiscall cv::VideoCapture::get(int)" ([email protected]@[email protected]@[email protected]) referenced in function _main 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: virtual __thiscall cv::VideoCapture::~VideoCapture(void)" ([email protected]@@[email protected]) referenced in function _main 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: virtual bool __thiscall cv::VideoCapture::isOpened(void)const " ([email protected]@[email protected]@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 &)" ([email protected]@@[email protected][email protected][email protected]@[email protected]@[email protected]@[email protected]@[email protected]@@Z) referenced in function _main 
1>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::fastFree(void *)" ([email protected]@@[email protected]) referenced in function "public: __thiscall cv::Mat::~Mat(void)" ([email protected]@@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::deallocate(void)" ([email protected]@[email protected]@QAEXXZ) referenced in function "public: void __thiscall cv::Mat::release(void)" ([email protected]@[email protected]@QAEXXZ) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::Scalar_<double> __cdecl cv::sum(class cv::_InputArray const &)" ([email protected]@@[email protected]@[email protected][email protected]@@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: class cv::MatExpr __thiscall cv::Mat::mul(class cv::_InputArray const &,double)const " ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::convertTo(class cv::_OutputArray const &,int,double,double)const " ([email protected]@[email protected]@[email protected]@[email protected]) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "void __cdecl cv::absdiff(class cv::_InputArray const &,class cv::_InputArray const &,class cv::_OutputArray const &)" ([email protected]@@[email protected]@[email protected]@@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: __thiscall cv::_OutputArray::_OutputArray(class cv::Mat &)" ([email protected]@@[email protected]@[email protected]@Z) referenced in function "double __cdecl getPSNR(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::Scalar_<double> __cdecl cv::mean(class cv::_InputArray const &,class cv::_InputArray const &)" ([email protected]@@[email protected]@[email protected][email protected]@[email protected]) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::_OutputArray const & __cdecl cv::noArray(void)" ([email protected]@@[email protected]@XZ) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
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)" ([email protected]@@[email protected]@[email protected]@[email protected]) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::MatExpr __cdecl cv::operator+(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::MatExpr __cdecl cv::operator+(class cv::MatExpr const &,class cv::Scalar_<double> const &)" ([email protected]@[email protected]@[email protected][email protected]@[email protected]@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "class cv::MatExpr __cdecl cv::operator*(double,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
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)" ([email protected]@@[email protected]@[email protected]@[email protected]@[email protected]@Z) referenced in function "class cv::Scalar_<double> __cdecl getMSSIM(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@[email protected]@[email protected]) 
1>openCVTest.obj : error LNK2019: unresolved external symbol "public: void __thiscall cv::Mat::copySize(class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@Z) referenced in function "public: __thiscall cv::Mat::Mat(class cv::Mat const &)" ([email protected]@@[email protected]@@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)" ([email protected]@@[email protected]@[email protected]@[email protected]) referenced in function "class cv::Mat & __cdecl cv::operator-=(class cv::Mat const &,class cv::Mat const &)" ([email protected]@[email protected]@[email protected]@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 ========== 

tôi đã đi qua tất cả các thư mục của tôi và chắc chắn rằng các thư viện, đã làm trong thực tế, tồn tại trong các tệp OpenCV của tôi và bản tải xuống của tôi không bị hỏng hoặc bất kỳ thứ gì. Bất kỳ trợ giúp sẽ được đánh giá cao!

-Logantf17

+0

Tôi cần biết bạn biết bạn đang làm gì. Bạn có biết cách liên kết với các thư viện không? Trên cái nhìn đầu tiên, có vẻ như đó là chính xác là mất tích. – guinny

+0

1. bạn đã tự biên soạn OpenCV chưa? 2. là các tập tin lib dưới (Properties -> Linker -> Input -> phụ thuộc bổ sung) trong dự án c hình ảnh của bạn? – guinny

+0

Vâng, tôi đang học như tôi đang đi. Tôi không cần phải liên kết với các thư viện trước đây (đây là lần đầu tiên tôi tìm thấy nó cần thiết). Tôi đã tìm cách liên kết các thư viện trong VS trước đó, để đảm bảo rằng tôi đã làm đúng. Nhưng tôi không biết nếu bất cứ điều gì khác là cần thiết .. Chẳng hạn như các tập tin tiêu đề hoặc các thư viện khác. – loganfarr

Trả lời

7

Tôi đã gặp sự cố tương tự và thấy rằng tôi đang nhắm mục tiêu nền tảng 32 bit. Câu trả lời là thay đổi dự án của tôi để nhắm mục tiêu x64. Các hướng dẫn được đặt tại: http://msdn.microsoft.com/en-us/library/vstudio/ms185328.aspx.

Tôi cũng tìm thấy tham chiếu được liệt kê ở trên bởi chaiy rất hữu ích. Đây là một lần nữa: http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_visual_studio_Opencv/windows_visual_studio_Opencv.html#windows-visual-studio-how-to

+0

Bạn đã lưu ngày của tôi !!!!!! ! – user2924714

Các vấn đề liên quan