Linux OpenCV 静态链接错误
错误一:
undefined reference to `dlopen'
undefined reference to `dlerror'
undefined reference to `dlsym'
对dlopen, dlerror, dlsym 未定义的引用, 缺少链接库, 链接时加上选项 -ldl
参考:
- http://blog.csdn.net/houjixin/article/details/8624581
- 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' failed
persistence.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
参考:
总结: 类似的未定义的引用错误,应该都是由于缺少库的原因引起的, 静态链接OpenCV库的时候, 不仅需要链接libopencv_***.a, 也需要 dl, zlib 等库, 出现类似错误时, 直接Google 未定义引用的函数对应的库, 然后在链接中添加上.
Linux OpenCV 静态链接错误的更多相关文章
- 配置使用OpenCV静态链接库
配置opencv静态链接库需要用到:staticlib 在配置链接器->附加库目录时应该为staticlib的路径.同理若是利用动态链接库则只需要lib的路径: 动态链接库则使用lib,然而在使 ...
- 利用CMake自己创建OpenCV静态链接库
1.准备工作: 1)完成Visual Studio2012安装: 2)下载并解压CMake3.5.0: 3)下载并解压OpenCV2.4.12: 4)下载并解压TBB44_20160128oss. 2 ...
- linux c静态链接库与动态链接库
库函数是我们编程的时候经常用到的,我们协作编程的时候可以将常用的函数封装成库供大家使用,这样能够提高大家的工作效率.对于库函数,它分为动态链接库和静态链接库.对于静态链接库我们必须是连接到可执行文件中 ...
- 由于C++类库版本不同导致的OpenCV编译链接错误
太长不看版:GCC4和GCC5使用的C++标准库下,string的名字不一样,导致链接错误. 之前在Ubuntu下使用OpenCV的时候一切正常.后来再次编译的时候,连接器提示有些库函数找不到: ma ...
- linux下静态链接库和动态链接库
关于链接库的知识,网上太多资料了,但是并不代表我很熟悉.今天遇到了 一个问题,就是由于静态链接库和ubuntu系统不兼容导致的,虽然花了点时间才搞定 但是,其中暴露的问题也不少. 没有区分好静态链接库 ...
- linux下静态链接库的用法
最近在Linux下编程发现一个诡异的现象,就是在链接一个静态库的时候总是报错,类似下面这样的错误: (.text+0x13): undefined reference to `func' 关于unde ...
- Linux下 静态链接库 和 动态链接库
先来说说C/C++编译过程 编译: 检查语句符号定义,将C/C++代码翻译生成中间语言. 链接: 将中间代码整合,生成可执行的二进制代码. 简单的说,库文件都是一种特殊的中间语言文件,静态库还是一种特 ...
- linux动态链接库和静态链接库
Linux下静态链接库与动态链接库的区别 引言 通常情况下,对函数库的链接是放在编译时期(compile time)完成的.所有相关的对象文件 (object file)与牵涉到的函数库(librar ...
- 创建和使用Windows静态链接库
首先明确这篇文章的目的,我希望大家能够通过这篇文章了解一下如何在实际工作中创建和使用Windows平台下的静态链接库.关于链接库的概念,希望大家参考维基百科"Library"词条( ...
随机推荐
- python 匹配中文和英文
在处理文本时经常会匹配中文名或者英文word,python中可以在utf-8编码下方便的进行处理. 中文unicode编码范围[\u4e00-\u9fa5] 英文字符编码范围[a-zA-Z] 此时匹配 ...
- java 资源文件夹下的MEAT-INF
META-INF文件夹是干啥的,META-INF文件夹的作用, META-INF文件夹能删吗 https://www.cnblogs.com/demingblog/p/5653844.html Jar ...
- CSP(Content Security Policy) 入门教程
参考: http://www.ruanyifeng.com/blog/2016/09/csp.html https://developer.mozilla.org/en-US/docs/Web/HTT ...
- 《高级Web应用程序设计》课件(20170911)
第一阶段:千里之行,始于足下 第1章 ASP.NET MVC概述 第2章 音乐商店制作 第二阶段:欲穷千里目,更上一层楼 第3章 设计模型 3.1 数据模型概述 3.2 使用EF Code First ...
- Android数据库框架-----GreenDao3的相关使用和版本升级更新
GreenDAO是一款非要流行的Android平台上的数据库框架,性能优秀,代码简洁:是一个将对象映射到SQLite数据库中的轻量且快速的ORM解决方案. GreenDAO 优势 1.一个精简的库 2 ...
- Metasploit 使用简介
Metasploit Framework 是非常优秀的开源渗透测试框架,像我这样的菜鸟刚刚听说,于是花时间好好研究了一下,整理了一下学习笔记,贴出来和大家一起交流.第一次写文章又不足的地方大家多多指点 ...
- Mybatis Generator 扩展
目标 修改Model的名称 修改Dao的名称 配置文件 context.targetRuntime 替换为自定义的类型 原理在:org.mybatis.generator.internal.Objec ...
- Quartz教程四:Trigger
原文链接 | 译文链接 | 翻译:nkcoder 本系列教程由quartz-2.2.x官方文档翻译.整理而来,希望给同样对quartz感兴趣的朋友一些参考和帮助,有任何不当或错误之处,欢迎指正:有兴趣 ...
- 高射炮打蚊子丨用Visual Studio 2017写最初级的C语言程序
众所周知,Visual Studio号称全宇宙最强的IDE(集成开发环境),简直可以“秒天秒地秒空气”.我们看着各种技术大会上,大神们在台上用VS演示Demo溜得飞起,然而对于一些非技术专业同学或者是 ...
- JPlayer使用之二,主要函数介绍
上一篇插件搭建的顺序最后一步的页面初始化函数中,就是最重要的一步,就先从这个函数说起吧. $("#jquery_jplayer_1").jPlayer({ ready: funct ...