2 years ago

#62426

test-img

OZ1SEJ

error: narrowing conversion of ‘-58’ from ‘int’ to ‘char’ [-Wnarrowing]

I'm trying to compile https://github.com/jbeder/yaml-cpp on a Raspberry Pi, and I'm getting this error:

/home/pi/yaml-cpp/test/binary_test.cpp:11:38: error: narrowing conversion of ‘-58’ from ‘int’ to ‘char’ [-Wnarrowing]
   11 |   std::string input{-58, -1, -99, 109};
      |                                      ^

I gather that I should explicitly declare the numbers inside the bracket as signed chars, as some older compilers might not do so by themselves. But I am wholly unfamiliar with this syntax: What does this line actually do?

c++

unsigned-char

0 Answers

Your Answer

Accepted video resources