I have a "Node" class, used for pathfinding. However, when I try to use it anywhere in my rclcpp project, I get errors like "error: cannot convert ‘rclcpp::Node*’ to ‘Node*’". I would expect this if I had specified "using namespace rclcpp" somewhere, but I didn't do that. Why would rclcpp::Node be conflicting with my global namespace Node class? What would be the best way to resolve this? I would like to avoid renaming my "Node" class, as it shouldn't be necessary if rclcpp is behaving properly.


  • $\begingroup$ Can you post a minimal code example that shows the behavior? $\endgroup$
    – JRTG
    Commented Apr 22 at 2:01
  • $\begingroup$ @JRTG I don't think this requires a code example since his problem is directly from docs. The class extends rclcpp::Node, but delegates construction to Node. This works and also surprised me. I don't think this is really desirable because there are plenty of use cases to call something Node and provocate a conflict. But I also don't think there is a direct answer to the question. He can't do much about it except namespace himself. $\endgroup$
    – Nyquist
    Commented Apr 24 at 17:51
  • $\begingroup$ @Nyquist The problem is not "directly from the docs", as the example you refer to compiles and runs just fine, without any issues. However, based on your comment I guess that what the OP means is that he implemented class Node : public rclcpp::Node{ ... }, which obviously seems bound for trouble. Then again, I re-read the question, and it could as well be that it's about a Node class and a rclcpp::Node class that are completely unrelated. Anyway, I have no intention to spend any more time on this question as long as I have to guess about the exact issue the OP wants to address. $\endgroup$
    – JRTG
    Commented Apr 25 at 7:27
  • $\begingroup$ I haven't thought about the former situation, but mainly refered to the latter. As I said, it is what I encountered myself. Using a library that uses a Node class that I use in the same scope as the rclcpp::Node, which is rather annoying. Anyhow, you are right, for the sake of focus of this question OP should clarify. $\endgroup$
    – Nyquist
    Commented Apr 25 at 7:33


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.