国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Linux > 正文

Linux OpenCV 靜態鏈接錯誤

2024-06-28 13:19:53
字體:
來源:轉載
供稿:網友
linux OpenCV 靜態鏈接錯誤

錯誤一:

undefined reference to `dlopen'

undefined reference to `dlerror'

undefined reference to `dlsym'

對dlopen, dlerror, dlsym 未定義的引用, 缺少鏈接庫, 鏈接時加上選項 -ldl

參考:

  1. http://blog.csdn.net/houjixin/article/details/8624581
  2. http://stackoverflow.com/questions/29557683/undefined-reference-to-symbol-dlsymglibc-2-4

錯誤二:

對icvPuts, icvGets 未定義的引用,編譯錯誤如下:

./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

缺少zlib庫引起的, 編譯鏈接時加上 -lz

參考:

  1. http://stackoverflow.com/questions/10858055/opencv2-4-with-android-native-activity

總結: 類似的未定義的引用錯誤,應該都是由于缺少庫的原因引起的, 靜態鏈接OpenCV庫的時候, 不僅需要鏈接libopencv_***.a, 也需要 dl, zlib 等庫, 出現類似錯誤時, 直接Google 未定義引用的函數對應的庫, 然后在鏈接中添加上.


發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 杭锦后旗| 江达县| 固原市| 黄浦区| 南投县| 宁津县| 湛江市| 河源市| 威海市| 延寿县| 宜川县| 准格尔旗| 武宣县| 离岛区| 博野县| 清水河县| 乌拉特前旗| 淄博市| 固始县| 东阳市| 迁安市| 樟树市| 保亭| 普洱| 七台河市| 噶尔县| 岳池县| 肇庆市| 太和县| 社旗县| 甘孜县| 乐山市| 龙南县| 宝鸡市| 横山县| 崇礼县| 会昌县| 武定县| 林口县| 印江| 垣曲县|