g++ 6.3编译opencv-2.48报错记录

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:1016:34: 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 $(MATCHBOX_PANEL_CFLAGS) \
        -I$(top_srcdir) -I$(top_builddir) -Werror

说是把 -Werror 去掉

但是opencv是依赖cmake编译的,于是根据报错信息进入到了相应的目录,在flags.make文件里面找到了-Werror=address,将其去掉,然后保存,重新编译后就成功了。

转载于:https://my.oschina.net/chaenomeles/blog/814048

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值