Linux OpenCV static Link error, linuxopencv

Source: Internet
Author: User

Linux OpenCV static Link error, linuxopencv

Error 1:

Undefined reference to 'dlopen'

Undefined referenceTo'Dlerror'

Undefined reference to 'dlsym'


Undefined reference to dlopen, dlerror, and dlsym. The Link Library is missing and the option-ldl is added to the link.

 

Refer:

 

Error 2:

For icvPuts and icvGets undefined references, the compilation error is as follows:

./obj/local/armeabi-v7a/libopencv_core.a(persistence.cpp.o): In function `icvPuts(CvFileStorage*, char const*)':persistence.cpp:(.text._ZL7icvPutsP13CvFileStoragePKc+0x20): undefined reference to `gzputs'./obj/local/armeabi-v7a/libopencv_core.a(persistence.cpp.o): In function `icvGets(CvFileStorage*, char*, int)':persistence.cpp:(.text._ZL7icvGetsP13CvFileStoragePci+0x26): undefined reference to `gzgets'./obj/local/armeabi-v7a/libopencv_core.a(persistence.cpp.o): In function `icvXMLSkipSpaces(CvFileStorage*, char*, int)':persistence.cpp:(.text._ZL16icvXMLSkipSpacesP13CvFileStoragePci+0x1e2): undefined reference to `gzgets'persistence.cpp:(.text._ZL16icvXMLSkipSpacesP13CvFileStoragePci+0x208): undefined reference to `gzeof'persistence.cpp:(.text._ZL16icvXMLSkipSpacesP13CvFileStoragePci+0x33c): undefined reference to `gzeof'./obj/local/armeabi-v7a/libopencv_core.a(persistence.cpp.o): In function `_ZL16icvYMLSkipSpacesP13CvFileStoragePcii.clone.3':persistence.cpp:(.text._ZL16icvYMLSkipSpacesP13CvFileStoragePcii.clone.3+0x124): undefined reference to `gzgets'persistence.cpp:(.text._ZL16icvYMLSkipSpacesP13CvFileStoragePcii.clone.3+0x170): undefined reference to `gzeof'/cygdrive/d/soft/NVPACK/android-ndk-r7c/build/core/build-binary.mk:366: recipe for target `obj/local/armeabi-v7a/libnative-activity.so' failedpersistence.cpp:(.text._ZL16icvYMLSkipSpacesP13CvFileStoragePcii.clone.3+0x28e): undefined reference to `gzeof'./obj/local/armeabi-v7a/libopencv_core.a(persistence.cpp.o): In function `cvReleaseFileStorage':persistence.cpp:(.text.cvReleaseFileStorage+0x24): undefined reference to `gzclose'./obj/local/armeabi-v7a/libopencv_core.a(persistence.cpp.o): In function `cvOpenFileStorage':persistence.cpp:(.text.cvOpenFileStorage+0x66e): undefined reference to `gzopen'persistence.cpp:(.text.cvOpenFileStorage+0x8fc): undefined reference to `gzclose'persistence.cpp:(.text.cvOpenFileStorage+0xaea): undefined reference to `gzrewind'persistence.cpp:(.text.cvOpenFileStorage+0xbee): undefined reference to `gzrewind'persistence.cpp:(.text.cvOpenFileStorage+0xc0a): undefined reference to `gzclose'collect2: ld returned 1 exit status

 

If the zlib library is missing, add-lz to the compilation link.

Refer:

 

Summary: similar undefined reference errors are caused by missing libraries. When statically linking the OpenCV library, you must not only link libopencv _***. a, also requires libraries such as dl and zlib. When a similar error occurs, Google will directly undefined the library corresponding to the referenced function, and then add it to the link.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.