ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How can I solve catkin error: "use of old-style cast"?

asked 2017-03-23 16:42:12 -0600

updated 2017-03-24 08:55:13 -0600

Catkin gives me an error on some third-party header files, which I included in my code. The error message says, the code was using old-style casts. I know, that the error results from the compiler option -Werror=old-style-cast, but I wasn't able to find an easy workaround without removing the flag from my CMakeLists.txt. I would like to allow old-style casts temporarily by passing the right compiler option to catkin_make or catkin build, but all my attempts have failed so far.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2017-03-24 08:55:40 -0600

This answer helped me, to find a solution for my problem:

catkin_make -DCMAKE_CXX_FLAGS="-Wno-error=old-style-cast"

This also works with catkin build.

A permanent fix would have been to just remove the -Werror=old-style-cast from my own CMakeLists.txt, of course. But I preferred to have a quick workaround to see, whether my code compiles in general and afterwards potentially go on and fix the third party code.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2017-03-23 16:42:12 -0600

Seen: 3,025 times

Last updated: Mar 24 '17