g++ 6.3編譯opencv-2.48報錯記錄

fetch公司的項目進行編譯,此項目依賴opencv庫。因爲本人一直比較偏心fedora,但也所以給我帶來了許多"樂趣"(麻煩)。fedora一直走得比較前沿,g++ 6.3了,因而在編譯的過程當中遇到了一些錯誤,在此記錄一下:fetch

/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]ui

 

在網上搜羅了一些答案:spa

cc1: warnings being treated as errors

AM_CFLAGS = -Wall -g $(MATCHBOX_PANEL_CFLAGS) \
        -I$(top_srcdir) -I$(top_builddir) -Werrorio

說是把 -Werror 去掉編譯

可是opencv是依賴cmake編譯的,因而根據報錯信息進入到了相應的目錄,在flags.make文件裏面找到了-Werror=address,將其去掉,而後保存,從新編譯後就成功了。opencv

相關文章
相關標籤/搜索