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

Compiler warning (c++11): Zero as null pointer constant

asked 2019-06-04 04:54:41 -0500

alex_ gravatar image

Hi,

I'm using QTCreator with ROS Plugin and compilie my nodes with C++11 support. I get the following compiler warning when using e.g. ROS_DEBUG(). How can setup QTCreator to ignore this warning?

Warning: zero as null pointer constant
expanded from macro 'ROS_DEBUG'
expanded from macro 'ROS_LOG'
expanded from macro 'ROS_LOG_COND'
expanded from macro 'ROSCONSOLE_DEFINE_LOCATION'

In CMakeLists.txt:

add_compile_options(-std=c++11)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2019-06-04 05:11:01 -0500

gvdhoorn gravatar image

updated 2019-06-04 05:13:40 -0500

Related: ros-industrial/ros_qtc_plugin#321.

How can setup QTCreator to ignore this warning?

I'm not sure whether you can do this globally, but you can suppress it per-file with:

#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant"

That's not very nice though as it now ignores those for everything, not just the macros.


It would appear this has already been addressed in ros/rosconsole#14. That has changed everything to use nullptr instead of 0, but that has only been released into Melodic, not Kinetic afaict (part of 1.13.8, but Kinetic only has 1.12.14).

edit flag offensive delete link more

Comments

Thanks! This makes it easier to focus on important :) warnings.

alex_ gravatar image alex_  ( 2019-06-04 06:01:38 -0500 )edit

Question Tools

Stats

Asked: 2019-06-04 04:54:41 -0500

Seen: 2,378 times

Last updated: Jun 04 '19