2

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

Shirui Ma
  • 33
  • 1
  • 4

2 Answers2

5

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.

karlphillip
  • 92,053
  • 36
  • 243
  • 426
  • Thanks a lot. I am used to install opencv 3.0 but because of this problem http://stackoverflow.com/questions/29650527/opencv-c-qt-cornersubpix-error/29724281#29724281 I can not use it when compiling my project. Is there a solution? – Shirui Ma Apr 19 '15 at 21:29
1

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.

dgatwood
  • 10,129
  • 1
  • 28
  • 49