5

I am using zxing and OpenCV lib in my project. I updated my XCode from 4.5 to 4.6 today and I am getting this error.

externalLibs/boost/include/boost/gil/channel_algorithm.hpp:54:85: Non-type template argument evaluates to -1, which cannot be narrowed to type 'unsigned long long'

And this error is on this line of code in one of the class of OpenCV Library:-

struct unsigned_integral_max_value : public mpl::
integral_c< UnsignedIntegralChannel,-1> {};

On Earlier version of Xcode its working fine.

Thanks in advance.

riyaz
  • 514
  • 4
  • 17

3 Answers3

1

It seems boost doesn't like c++ 11 support added with the new clang compiler

so.. it say disable c++ 11 support in build settings enter image description here

= src: see https://svn.boost.org/trac/boost/ticket/7270

Daij-Djan
  • 49,552
  • 17
  • 113
  • 135
0

The max value of an unsigned long long variable is in hex 0xFFFFFFFF FFFFFFFF, i.e. all bits are 1's. If interpreted as a signed number, this corresponds to a -1. So often programmers use -1 instead, hoping that the compiler will not complain. Apparently, this did not happen in XCode 4.5, but 4.6 does more rigorous checking...

Reinhard Männer
  • 14,022
  • 5
  • 54
  • 116
0

I'm running into the same error when compiling on macOS Sierra with Apple LLVM version 8.1.0 (clang-802.0.42) and -std=c++11. To solve the problem I included the following compiler flag: -Wno-error=c++11-narrowing

Jaime Ivan Cervantes
  • 3,579
  • 1
  • 40
  • 38