Build opencv 2.4.10 on Mac 10.10.3 failed

半腔热情 提交于 2019-12-02 05:08:15

问题


I tried to build opencv 2.4.10 on Mac 10.10.3 with Xcode 6.3. And the following errors occurred by building.

/Users/Shirui/work/program/opencv-2.4.10/modules/legacy/src/calibfilter.cpp:98:9: error: comparison of array 'this->latestPoints' not equal to a null pointer is always true [-Werror,-Wtautological-pointer-compare] if (latestPoints != NULL) ^~~~~~~~~~~~ ~~~~ /Users/Shirui/work/program/opencv-2.4.10/modules/legacy/src/calibfilter.cpp:526:9: error: address of array 'this->latestCounts' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion] if( latestCounts ) ~~ ^~~~~~~~~~~~ 2 errors generated.

The commands I used:

mkdir path-to-opencv-source/build
cd path-to-opencv-source/build
cmake -G "Unix Makefiles" ..
make -j8

Thanks a lot


回答1:


That's actually a problem that happens when building OpencV with clang.

It was first discussed here, and fixed here.

You can do the fix youself, of course, or just download a more recent version of OpenCV.




回答2:


I'm told that you can disable the warning globally by adding -Wno-tautological-pointer-compare to your compiler flags, or on a one-off basis by wrapping the variable you're testing in parentheses.



来源:https://stackoverflow.com/questions/29724408/build-opencv-2-4-10-on-mac-10-10-3-failed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!