cbandera / rosparam_handler

An easy wrapper for using parameters in ROS
Other
47 stars 26 forks source link

Allow multiple configuration files per package #11

Closed mfueller closed 7 years ago

mfueller commented 7 years ago

When using multiple configuration files in one package, you will get a "redefinition" error during the compilation, e.g: ... <myConfig>Parameters.h:27:20: error: redefinition of 'std::__cxx11::string <myPackageName>:getNodeName(const ros::NodeHandle&)'

The attached preprocessor statements avoid the redefinition.

cbandera commented 7 years ago

I never had the usecase. But thanks for pointing it out and providing the fix.

cbandera commented 7 years ago

Did you really mean several configs per package or per node? Because I think you can have several executables in a package without conflicts.

mfueller commented 7 years ago

mhh, I think I was wrong and it is several config files per package. It happens when you compile one node with several config files.

If I now think one step further, you might get the same trouble when you have two config files from two different packages compiled in one node. I think the #ifndef UTIL_FUNCTIONS_${pkgname} statement should be changed to a general #ifndef ROSPARAM_HANDLER_UTIL_FUNCTIONS statement. What do you think?

cbandera commented 7 years ago

If the two configs come from different packages, they will be in different namespaces and should be ok.