Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
274 views
in Technique[技术] by (71.8m points)

c++ - OpenCV Unresolved External Symbols - Other Libraries Needed?

I'm trying to use OpenCV 2.3.1 for a video capture and processing app. I downloaded the precompiled libraries from here and went to compile a test application using the static libraries found in the buildx86vc10staticlib of the download folder. Upon trying to compile, Visual Studio greets me with the linker errors shown below. Having worked with libpng, gzip, and a few others in the past, I recognize the functions from those libraries in the linker errors.

Does using the precompiled libraries of OpenCV also require me to link in libpng, libjpeg, gzip, and numerous others, or am I missing something?

1>opencv_core231d.lib(persistence.obj) : error LNK2019: unresolved external symbol _gzputs referenced in function "void __cdecl icvPuts(struct CvFileStorage *,char const *)" (?icvPuts@@YAXPAUCvFileStorage@@PBD@Z)
1>opencv_core231d.lib(persistence.obj) : error LNK2019: unresolved external symbol _gzclose referenced in function "void __cdecl icvClose(struct CvFileStorage *)" (?icvClose@@YAXPAUCvFileStorage@@@Z)
1>opencv_core231d.lib(persistence.obj) : error LNK2019: unresolved external symbol _gzopen referenced in function _cvOpenFileStorage
1>opencv_core231d.lib(persistence.obj) : error LNK2019: unresolved external symbol _gzgets referenced in function "char * __cdecl icvGets(struct CvFileStorage *,char *,int)" (?icvGets@@YAPADPAUCvFileStorage@@PADH@Z)
1>opencv_core231d.lib(persistence.obj) : error LNK2019: unresolved external symbol _gzrewind referenced in function "void __cdecl icvRewind(struct CvFileStorage *)" (?icvRewind@@YAXPAUCvFileStorage@@@Z)
1>opencv_core231d.lib(persistence.obj) : error LNK2019: unresolved external symbol _gzeof referenced in function "int __cdecl icvEof(struct CvFileStorage *)" (?icvEof@@YAHPAUCvFileStorage@@@Z)
1>opencv_highgui231d.lib(window_w32.obj) : error LNK2019: unresolved external symbol __imp__CreateToolbarEx@52 referenced in function "int __cdecl icvCreateTrackbar(char const *,char const *,int *,int,void (__cdecl*)(int),void (__cdecl*)(int,void *),void *)" (?icvCreateTrackbar@@YAHPBD0PAHHP6AXH@ZP6AXHPAX@Z3@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIFileRelease@4 referenced in function "public: virtual void __thiscall CvCaptureAVI_VFW::close(void)" (?close@CvCaptureAVI_VFW@@UAEXXZ)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIStreamRelease@4 referenced in function "public: virtual void __thiscall CvCaptureAVI_VFW::close(void)" (?close@CvCaptureAVI_VFW@@UAEXXZ)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIStreamGetFrameClose@4 referenced in function "public: virtual void __thiscall CvCaptureAVI_VFW::close(void)" (?close@CvCaptureAVI_VFW@@UAEXXZ)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIStreamGetFrameOpen@8 referenced in function "public: virtual bool __thiscall CvCaptureAVI_VFW::open(char const *)" (?open@CvCaptureAVI_VFW@@UAE_NPBD@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIStreamInfoA@12 referenced in function "public: virtual bool __thiscall CvCaptureAVI_VFW::open(char const *)" (?open@CvCaptureAVI_VFW@@UAE_NPBD@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIFileGetStream@16 referenced in function "public: virtual bool __thiscall CvCaptureAVI_VFW::open(char const *)" (?open@CvCaptureAVI_VFW@@UAE_NPBD@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIFileOpenA@16 referenced in function "public: virtual bool __thiscall CvCaptureAVI_VFW::open(char const *)" (?open@CvCaptureAVI_VFW@@UAE_NPBD@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIFileInit@0 referenced in function "void __cdecl icvInitCapture_VFW(void)" (?icvInitCapture_VFW@@YAXXZ)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIStreamGetFrame@8 referenced in function "public: virtual bool __thiscall CvCaptureAVI_VFW::grabFrame(void)" (?grabFrame@CvCaptureAVI_VFW@@UAE_NXZ)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _ICClose@4 referenced in function "protected: void __thiscall CvCaptureCAM_VFW::closeHIC(void)" (?closeHIC@CvCaptureCAM_VFW@@IAEXXZ)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _ICSendMessage@16 referenced in function "protected: void __thiscall CvCaptureCAM_VFW::closeHIC(void)" (?closeHIC@CvCaptureCAM_VFW@@IAEXXZ)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _capCreateCaptureWindowA@32 referenced in function "public: virtual bool __thiscall CvCaptureCAM_VFW::open(int)" (?open@CvCaptureCAM_VFW@@UAE_NH@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _capGetDriverDescriptionA@20 referenced in function "public: virtual bool __thiscall CvCaptureCAM_VFW::open(int)" (?open@CvCaptureCAM_VFW@@UAE_NH@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _ICDecompress referenced in function "public: virtual struct _IplImage * __thiscall CvCaptureCAM_VFW::retrieveFrame(int)" (?retrieveFrame@CvCaptureCAM_VFW@@UAEPAU_IplImage@@H@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _ICOpen@12 referenced in function "public: virtual struct _IplImage * __thiscall CvCaptureCAM_VFW::retrieveFrame(int)" (?retrieveFrame@CvCaptureCAM_VFW@@UAEPAU_IplImage@@H@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIStreamSetFormat@16 referenced in function "protected: bool __thiscall CvVideoWriter_VFW::createStreams(struct CvSize,bool)" (?createStreams@CvVideoWriter_VFW@@IAE_NUCvSize@@_N@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIMakeCompressedStream@16 referenced in function "protected: bool __thiscall CvVideoWriter_VFW::createStreams(struct CvSize,bool)" (?createStreams@CvVideoWriter_VFW@@IAE_NUCvSize@@_N@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVISaveOptions@20 referenced in function "protected: bool __thiscall CvVideoWriter_VFW::createStreams(struct CvSize,bool)" (?createStreams@CvVideoWriter_VFW@@IAE_NUCvSize@@_N@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIFileCreateStreamA@12 referenced in function "protected: bool __thiscall CvVideoWriter_VFW::createStreams(struct CvSize,bool)" (?createStreams@CvVideoWriter_VFW@@IAE_NUCvSize@@_N@Z)
1>opencv_highgui231d.lib(cap_vfw.obj) : error LNK2019: unresolved external symbol _AVIStreamWrite@32 referenced in function "public: virtual bool __thiscall CvVideoWriter_VFW::writeFrame(struct _IplImage const *)" (?writeFrame@CvVideoWriter_VFW@@UAE_NPBU_IplImage@@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_destroy referenced in function "public: void __thiscall cv::Jpeg2KDecoder::close(void)" (?close@Jpeg2KDecoder@cv@@QAEXXZ)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_stream_close referenced in function "public: void __thiscall cv::Jpeg2KDecoder::close(void)" (?close@Jpeg2KDecoder@cv@@QAEXXZ)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_decode referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readHeader(void)" (?readHeader@Jpeg2KDecoder@cv@@UAE_NXZ)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_stream_fopen referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readHeader(void)" (?readHeader@Jpeg2KDecoder@cv@@UAE_NXZ)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_matrix_destroy referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readData(class cv::Mat &)" (?readData@Jpeg2KDecoder@cv@@UAE_NAAVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_readcmpt referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readData(class cv::Mat &)" (?readData@Jpeg2KDecoder@cv@@UAE_NAAVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_matrix_create referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readData(class cv::Mat &)" (?readData@Jpeg2KDecoder@cv@@UAE_NAAVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_getcmptbytype referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readData(class cv::Mat &)" (?readData@Jpeg2KDecoder@cv@@UAE_NAAVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_cmprof_destroy referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readData(class cv::Mat &)" (?readData@Jpeg2KDecoder@cv@@UAE_NAAVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_chclrspc referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readData(class cv::Mat &)" (?readData@Jpeg2KDecoder@cv@@UAE_NAAVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_cmprof_createfromclrspc referenced in function "public: virtual bool __thiscall cv::Jpeg2KDecoder::readData(class cv::Mat &)" (?readData@Jpeg2KDecoder@cv@@UAE_NAAVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_encode referenced in function "public: virtual bool __thiscall cv::Jpeg2KEncoder::write(class cv::Mat const &,class std::vector<int,class std::allocator<int> > const &)" (?write@Jpeg2KEncoder@cv@@UAE_NABVMat@2@ABV?$vector@HV?$allocator@H@std@@@std@@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_strtofmt referenced in function "public: virtual bool __thiscall cv::Jpeg2KEncoder::write(class cv::Mat const &,class std::vector<int,class std::allocator<int> > const &)" (?write@Jpeg2KEncoder@cv@@UAE_NABVMat@2@ABV?$vector@HV?$allocator@H@std@@@std@@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_create referenced in function "public: virtual bool __thiscall cv::Jpeg2KEncoder::write(class cv::Mat const &,class std::vector<int,class std::allocator<int> > const &)" (?write@Jpeg2KEncoder@cv@@UAE_NABVMat@2@ABV?$vector@HV?$allocator@H@std@@@std@@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_image_writecmpt referenced in function "protected: bool __thiscall cv::Jpeg2KEncoder::writeComponent8u(void *,class cv::Mat const &)" (?writeComponent8u@Jpeg2KEncoder@cv@@IAE_NPAXABVMat@2@@Z)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_init referenced in function "public: __thiscall cv::JasperInitializer::JasperInitializer(void)" (??0JasperInitializer@cv@@QAE@XZ)
1>opencv_highgui231d.lib(grfmt_jpeg2000.obj) : error LNK2019: unresolved external symbol _jas_cleanup referenced in function "public: __thiscall cv::JasperInitializer::~JasperInitializer(void)" (??1JasperInitializer@cv@@QAE@XZ)
1>opencv_highgui231d.lib(grfmt_png.obj) : error LNK2019: unresolved external symbol _png_destroy_read_

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I have a static build of OpenCV with most of the bells and whistles. VC10 OpenCV2.4.9(OCL woo) To fix a very similar problem I just linked to all of the following:

libpng.lib
libtiff.lib
zlib.lib
IlmImf.lib
libjasper.lib
libjpeg.lib

They were inside C:Libopencv249opencvld323rdpartylibRelease

-Not sure which one did it but what the heck. Thanks Loozie!

PK


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...