Ask Your Question
0

Basic Int32 and std_msgs question

asked 2015-07-13 15:21:17 -0500

The_Mad_Geometer gravatar image

updated 2015-07-14 02:17:39 -0500

gvdhoorn gravatar image

I'm very new to working in Ros. I am trying to figure out how to read from a bag file and so I'm interested in making a small bag file for testing purposes. I have wrapped the code for writing the integer 42 inside a main function and attempted to run it within a catkin package using catkin_make. I get the following error:

[ 81%] Building CXX object test/CMakeFiles/test_write_bag.dir/src/test_write_bag.cpp.o
/home/ryan/catkin_ws/src/test/src/test_write_bag.cpp: In function ‘int main(int, char**)’:
/home/ryan/catkin_ws/src/test/src/test_write_bag.cpp:8:2: error: ‘Int32’ is not a member of ‘std_msgs’
  std_msgs::Int32 i;
  ^
/home/ryan/catkin_ws/src/test/src/test_write_bag.cpp:8:18: error: expected ‘;’ before ‘i’
  std_msgs::Int32 i;
                  ^
/home/ryan/catkin_ws/src/test/src/test_write_bag.cpp:9:2: error: ‘i’ was not declared in this scope
  i.data = 42;
  ^
make[2]: *** [test/CMakeFiles/test_write_bag.dir/src/test_write_bag.cpp.o] Error 1
make[1]: *** [test/CMakeFiles/test_write_bag.dir/all] Error 2
make: *** [all] Error 2
Invoking "make -j1 -l1" failed

Does anyone know what I've done wrong or forgotten to set up within the project?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2015-07-13 21:47:48 -0500

ahendrix gravatar image

Did you #include <std_msgs/Int32.h> along with your other headers?

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-07-13 15:21:17 -0500

Seen: 932 times

Last updated: Jul 14 '15