ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
See the documentation for std_msgs/Float32:
Raw Message Definition
float32 data
std_msgs/Float32
is not just an alias for a double
or float
. It's a message structure, with a member. You cannot assign a scalar (such as 1.0
) to a structure in C (or in most languages actually).
The value should be assigned to the data
member. The following should work:
a.data = 1.0;
Note also that the error message Visual Studio gives you is rather descriptive:
E0349 no operator "=" matches these operands [..] ConsoleApplication1.cpp 32