Non-type template argument evaluates to -1, which cannot be narrowed to type 'unsigned long long' xcode 4.6

StackOverflow https://stackoverflow.com/questions/14583274

  •  06-03-2022
  •  | 
  •  

Pergunta

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.

Foi útil?

Solução

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

Outras dicas

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...

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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top