g++ 6.4编译opencv-2.4.10报错记录
fetch公司的项目进行编译,此项目依赖opencv库。由于本人一直比较偏爱fedora,但也因此给我带来了许多"乐趣"(麻烦)。fedora一直走得比较前沿,g++ 6.3了,于是在编译的过程中遇到了一些错误,在此记录一下:
/home/hiscene/Downloads/opencv-2.4.8.3/modules/contrib/src/chamfermatching.cpp:969:30: error: the compiler can assume that the address of ‘annotate_img’ will never be NULL [-Werror=address]
if (&annotate_img!=NULL) {
^
/home/hiscene/Downloads/opencv-2.4.8.3/modules/contrib/src/chamfermatching.cpp:
In member function ‘cv::ChamferMatcher::Match*
cv::ChamferMatcher::Matching::localChamferDistance(cv::Point,
cv::Mat&, cv::Mat&, cv::ChamferMatcher::Template*, float)’:
/home/hiscene/Downloads/opencv-2.4.8.3/modules/contrib/src/chamfermatching.cpp:1111:25: error: the compiler can assume that the address of ‘orientation_img’ will never be NULL [-Werror=address]
在网上搜罗了一些答案:
cc1: warnings being treated as errors
AM_CFLAGS = -Wall -g (top_srcdir) -I$(top_builddir) -Werror
说是把 -Werror 去掉
但是opencv是依赖cmake编译的,于是根据报错信息进入到了相应的目录,在flags.make文件里面找到了-Werror=address,将其去掉,然后保存,重新编译后就成功了
每一个不曾起舞的日子,都是对生命的辜负。
But it is the same with man as with the tree. The more he seeks to rise into the height and light, the more vigorously do his roots struggle earthward, downward, into the dark, the deep - into evil.
其实人跟树是一样的,越是向往高处的阳光,它的根就越要伸向黑暗的地底。----尼采
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 展开说说关于C#中ORM框架的用法!