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

The same exact warning annoyed me for a while. In my case the warnings are coming from the CLang Code Model inspector (in QTCreator). I guess that what's happening is what the warning is suggesting, that the operator "is explicitly instantiated in another translation unit".

The only solution I found is to use forward declarations:

template<> ros::Duration ros::TimeBase<ros::Time, ros::Duration>::operator-(const ros::Time &rhs) const;
template<> bool ros::TimeBase<ros::Time, ros::Duration>::operator<(const ros::Time &rhs) const;
template<> bool ros::TimeBase<ros::Time, ros::Duration>::operator>(const ros::Time &rhs) const;

The same exact warning annoyed me for a while. In my case the warnings are coming from the CLang Code Model inspector (in QTCreator). I guess that what's happening is what the warning is suggesting, that the operator "is explicitly instantiated in another translation unit".

The only solution I found is to use forward declarations:declarations, here are some examples for -, < and >:

template<> ros::Duration ros::TimeBase<ros::Time, ros::Duration>::operator-(const ros::Time &rhs) const;
template<> bool ros::TimeBase<ros::Time, ros::Duration>::operator<(const ros::Time &rhs) const;
template<> bool ros::TimeBase<ros::Time, ros::Duration>::operator>(const ros::Time &rhs) const;