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

when I use the code copy from rosbag tutorials,there some wrong?

asked 2015-01-30 23:52:39 -0500

cros gravatar image

when I use the code copy from the tutorial(,but there are some wrong like this:error: expected primary-expression before ‘const’ foreach(rosbag::MessageInstance const m, view); error: ‘foreach’ was not declared in this scope foreach(rosbag::MessageInstance const m, view); I don't know how to correct,I hope someone can help me ,thank you!

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2015-01-31 01:09:47 -0500

ahendrix gravatar image

foreach is not a valid keyword in C++; the rosbag tutorials assume that you have foreach defined as BOOST_FOREACH:

#include <boost/foreach.hpp>
#define foreach BOOST_FOREACH
edit flag offensive delete link more


thank you ,then can you tell me what's function of 'foreach',

cros gravatar image cros  ( 2015-01-31 07:13:37 -0500 )edit

The BOOST_FOREACH documentation defines the behavior of BOOST_FOREACH fairly well.

ahendrix gravatar image ahendrix  ( 2015-01-31 15:50:32 -0500 )edit

Question Tools

1 follower


Asked: 2015-01-30 23:52:39 -0500

Seen: 682 times

Last updated: Jan 31 '15