Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Tooo-Top opened this issue Jan 29, 2023 · 2 comments

Comments

@Tooo-Top
Copy link

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
Copy link

gdizcm commented Apr 21, 2023

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

add_compile_options(-Wno-narrowing)

@Tooo-Top
Copy link
Author

Tooo-Top commented Mar 8, 2024

Thank you, the problem has been resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants