ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
1 | initial version |
No, C++ does not allow that.
However, you may create a file named my_services.hpp
with all the includes.
#pragma once
#include "srv_pkg/srv/service_1"
#include "srv_pkg/srv/service_2"
#include "srv_pkg/srv/service_3"
#include "srv_pkg/srv/service_4"
Then in all the places where you need to use the services you can just use #include "my_services.hpp
.
An alternative would be to use a script to automatically add all the include directives to your files, but I really think that's a bad and error-prone solution.
2 | No.2 Revision |
No, C++ does not allow that.
However, you may create a file named my_services.hpp
with all the includes.
#pragma once
#include "srv_pkg/srv/service_1"
#include "srv_pkg/srv/service_2"
#include "srv_pkg/srv/service_3"
#include "srv_pkg/srv/service_4"
Then in all the places where you need to use the services you can just use #include
."my_services.hpp"my_services.hpp"
An alternative would be to use a script to automatically add all the include directives to your files, but I really think that's a bad and error-prone solution.