2012-11-20 74 views
7

我想在64位vs10控制檯應用程序中使用openCV243靜態庫。我的操作系統是win7 64位。openCV 243使用靜態庫錯誤LNK2019

我已經包括以下庫:

#pragma comment(lib,"../final_test/libs/staticlib/opencv_core243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_highgui243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_imgproc243.lib")  
#pragma comment(lib,"../final_test/libs/staticlib/opencv_video243d.lib")   
#pragma comment(lib,"../final_test/libs/staticlib/opencv_flann243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_features2d243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_objdetect243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_core243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_calib3d243.lib")  
#pragma comment(lib,"../final_test/libs/staticlib/opencv_legacy243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_features2d243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_ml243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/libjpeg.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/libpng.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/libtiff.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/libjasper.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/zlib.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/IlmImf.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_videostab243") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_contrib243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_nonfree243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_photo243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_stitching243.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/IlmImf.lib") 
#pragma comment(lib,"../final_test/libs/staticlib/opencv_ts243.lib") 

的運行時庫:多線程(/ MT)

我獲得以下鏈接錯誤。

1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol AVIFileInit referenced in function "void __cdecl icvInitCapture_VFW(void)" ([email protected]@YAXXZ) 
1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol AVIStreamGetFrameOpen referenced in function "public: virtual bool __cdecl CvCaptureAVI_VFW::open(char const *)" ([email protected][email protected]@[email protected]) 
1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol AVIStreamInfoA referenced in function "public: virtual bool __cdecl CvCaptureAVI_VFW::open(char const *)" ([email protected][email protected]@[email protected]) 
1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol AVIFileGetStream referenced in function "public: virtual bool __cdecl CvCaptureAVI_VFW::open(char const *)" ([email protected][email protected]@[email protected]) 
1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol AVIFileOpenA referenced in function "public: virtual bool __cdecl CvCaptureAVI_VFW::open(char const *)" ([email protected][email protected]@[email protected]) 
1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol AVIStreamGetFrame referenced in function "public: virtual bool __cdecl CvCaptureAVI_VFW::grabFrame(void)" ([email protected][email protected]@UEAA_NXZ) 
1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol ICClose referenced in function "protected: void __cdecl CvCaptureCAM_VFW::closeHIC(void)" ([email protected][email protected]@IEAAXXZ) 
1>opencv_highgui243.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol ICSendMessage referenced in function "protected: void __cdecl CvCaptureCAM_VFW::closeHIC(void)" ([email protected][email protected]@IEAAXXZ) 

...

誰能幫我擺脫這個問題?謝謝。

+0

當你不包含「highgui」lib時它會被編譯嗎? – Niko

+0

這可能也有幫助:http://stackoverflow.com/questions/849238/how-can-i-resolve-error-lnk2019-unresolved-external-symbol – Niko

+0

感謝您的意見。 不幸的是,沒有highgui項目不編譯。 – user1043413

回答

13

您需要鏈接MS vfw32.lib庫。

+2

comctl32.lib也需要 –

+0

我可以得到更多的幫助,如何做到這一點? –

+0

@ChaiNadig可以通過furqan或VC++ 2010 Express:項目屬性(Alt-F7) - >配置屬性 - >鏈接器 - >輸入來回答pragmas:點擊附加依賴項的值下拉菜單,<編輯... >,粘貼上面的庫文件列表。您將在單獨的行上包含vfw32.lib和comctl32.lib,並從%OPENCV_DIR%\ build \ x86 \ vc10 \ staticlib獲取庫。 – sastanin

5

只是在你的頭文件中做到這一點。它應該完美地工作。

#include "opencv2/opencv.hpp" 
#pragma comment(lib, "vfw32.lib") 
#pragma comment(lib, "comctl32.lib") 
+0

這是否也適用於64位? – tzippy

+0

是的,爲什麼不呢,它應該工作。 – furqan

+0

所以沒有64位版本,我應該鏈接?或者這些文件在我的system32文件夾中自動爲64位?我正在運行一個64位的Windows 7.我遇到的問題是,因爲我編譯爲64位,'cv:VideoCapture :: readMat(CV_OUT Mat&image)'返回一個空的'cv :: Mat' – tzippy