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

Revision history [back]

click to hide/show revision 1
initial version

Well, generally you can disable gcc warnings and errors by passing a -Wno-.. variant of the involved warning option.

In this case that would be -Wno-unused-variable.

Well, generally you can disable gcc warnings and errors by passing a -Wno-.. variant of the involved warning option.

In this case that would be -Wno-unused-variable.

Btw, this is really not ROS specific at all, but a simple gcc configuration problem, and well documented:

You can request many specific warnings with options beginning with ‘-W’, for example -Wimplicit to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning ‘-Wno-’ to turn off warnings; for example, -Wno-implicit.

From GCC Command Options - Warning Options in the GCC manual.

Well, generally you can disable gcc warnings and errors by passing a -Wno-.. variant of the involved warning option.

In this case that would be -Wno-unused-variable.

Btw, this is really not ROS specific at all, but a simple gcc configuration problem, and well documented:

You can request many specific warnings with options beginning with ‘-W’, for example -Wimplicit to request warnings on implicit declarations. Each of these specific warning options also has a negative form beginning ‘-Wno-’ to turn off warnings; for example, -Wno-implicit.

From GCC Command Options - Warning Options in the GCC manual.


Edit: suppressing these kinds of warnings and errors is typically not a good idea. If you must do it, try to narrow the scope of the suppression as much as possible by setting the flag on the CMake target using set_target_properties(${TARGET} PROPERTIES ...) instead of globally using add_definitions(..).