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

Revision history [back]

click to hide/show revision 1
initial version

I found that while looking through the node_handle class code, but I still got the same error. It was like of the compiler was just trying to match the parameters with the 1-parameter version that takes in only a SubscribeOptions object.

Actually I ended up added the following:

template<class M, class C> Subscriber subscribe(const std::string& topic, uint32_t queue_size, void(*fp)(const boost::shared_ptr<M const>&));

to the "ros\fuerte\x86\include\ros\node_handle.h" file, right after to line 785 which contains:

Subscriber subscribe(SubscribeOptions& ops);

I haven't messed around with C++ for some years now, been mainly working in C# so I'm not really sure what is the issue, it just seemed to me that if I was inside another class/namespace, the compiler wasn't finding all the versions of the function because they are all templated, and just found this one on line 785, so I tried replicating it for the version I wanted.. It compiled correctly and is now working.

Interestingly, I was still forced to add the class pointer parameter, as without it, the compiler produces the same error.

Maybe I should take some lessons on templates, because right now this just seems like creepy stuff to me :)

Anyway, problem solved. Thanks for the support!