eProsima / RPC

RPC over TCP/DDS/REST
Apache License 2.0
60 stars 32 forks source link

error: narrowing conversion of ‘***********’ from ‘unsigned int’ to ‘int’ [-Wnarrowing] #20

Open Tooo-Top opened 1 year ago

Tooo-Top commented 1 year ago

hello: I'm trying to build rpc library from source.

When executing command: cmake --build . --target install

show err :

/home/fastdds/RPC-master/examples/C++/rpcdds/c++11Types/RTPSCalculator/CalculatorDDSProtocol.cxx:131:22: error: narrowing conversion of ‘3418803882’ from ‘unsigned int’ to ‘int’ [-Wnarrowing]
  131 |                 case 0xCBC6CEAA:
      |                      ^~~~~~~~~~
/home/fastdds/RPC-master/examples/C++/rpcdds/c++11Types/RTPSCalculator/CalculatorDDSProtocol.cxx:174:22: error: narrowing conversion of ‘3389102612’ from ‘unsigned int’ to ‘int’ [-Wnarrowing]
  174 |                 case 0xCA019A14:
      |                      ^~~~~~~~~~
gdizcm commented 1 year ago

I add the following words in my cmakelists.txt to avoid narrow conversion.

add_compile_options(-Wno-narrowing)

Tooo-Top commented 8 months ago

Thank you, the problem has been resolved.