Has anyone gotten node.cpp(330): error C2131: expression did not evaluate to a constant, on catkin_make of rplidar_ros package?

asked 2020-05-12 10:42:59 -0600

JayROS gravatar image

updated 2020-05-12 11:03:52 -0600

gvdhoorn gravatar image

Hi there,

I've been using RosOnWindows (Windows 10, melodic) successfully for about 6 months. I just obtained an Rplidar A2M8.

I was able to download the driver and successfully ran the frame grabber, to make sure it works.

I cloned the software from: https://github.com/slamtec/rplidar_ros into my workspace.

I attempted to catkin_make the workspace.

I actually received two errors:

...rplidar_ros\src\node.cpp(330): error C2131: expression did not evaluate to a constant
...rplidar_ros\src\node.cpp(328): note: failure was caused by a read of a variable outside its lifetime
...rplidar_ros\src\node.cpp(328): note: see usage of 'angle_compensate_multiple'
...rplidar_ros\src\node.cpp(344): error C3863: array type 'rplidar_response_measurement_node_hq_t [angle_compensate_nodes_count]' is not assignable

I searched but didn't find any hits concerning people having problems simply compiling after just cloning. Any help, hints would be appreciated. Thanks in advance.

edit retag flag offensive close merge delete


MSVC does not seem to support variable length arrays. These are a C99 feature, while MSVC conforms to the C90 standard. They are also not a part of ISOC++. gcc allows some extensions and features such as this one, so it builds. Compiling with -pedantic will warn about line 330.

pcoenen gravatar image pcoenen  ( 2020-05-13 06:37:50 -0600 )edit

Thank you very much for your quick answer. I really appreciate your help!

JayROS gravatar image JayROS  ( 2020-05-13 11:02:04 -0600 )edit