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

Tutorials: Writing Simple Server Client Bug?

asked 2015-02-28 04:27:46 -0600

End-Effector gravatar image

Hello,

so I'm doing the tutorials and I got a problem in this one.

Where do you get this file? #include "beginner_tutorials/AddTwoInts.h"?

I know that you have to go back look at creating the AddTwoInts.srv Tutorial.

But my problem is how do you get the .h file?

This file is needed for both service and client.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2015-02-28 07:13:01 -0600

Andromeda gravatar image

updated 2015-02-28 07:16:13 -0600

You don't need to find it. It is going to be created during compiling. To do that add the following line in your cmakelists

add_executable(add_two_ints_server src/add_two_ints_server.cpp)
target_link_libraries(add_two_ints_server ${catkin_LIBRARIES})
add_dependencies(add_two_ints_server beginner_tutorials_gencpp)    // <= you need this line

from here.

Of course it is mandatory to create at first your srv file in the project folder as described here.

In the right order:

  1. create the srv file and add it into your cmakelists;
  2. add the above line as at the beginning suggested (to tell the compiler to generate the needed .h file at first);
  3. compile with catkin_make;
edit flag offensive delete link more

Comments

Hum I had those lines included in my CMakeLists.txt, I followed the tutorial.

I get the this error when I do the catkin_make:

/home/paulo/catkin_ws/src/beginner_tutorials/src/add_two_ints_client.cpp:2:43: fatal error: beginner_tutorials/AddTwoInts.h: No such file or directory
 #include "be
End-Effector gravatar image End-Effector  ( 2015-02-28 08:14:25 -0600 )edit

#include "beginner_tutorials/AddTwoInts.h" ^ /home/paulo/catkin_ws/src/beginner_tutorials/src/add_two_ints_server.cpp:2:43: fatal error: beginner_tutorials/AddTwoInts.h: No such file or directory #include "beginner_tutorials/AddTwoInts.h"

End-Effector gravatar image End-Effector  ( 2015-02-28 08:16:30 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-02-28 04:27:46 -0600

Seen: 602 times

Last updated: Feb 28 '15