user2505961
user2505961

Reputation: 150

How to use the paho mqtt library with a C++ ros node

I just spend some time trying to figure out how to use the Paho Mqtt library in a C++ Rosnode and write this in case anybody has the same problem.

Upvotes: 0

Views: 1193

Answers (1)

user2505961
user2505961

Reputation: 150

Install the Paho library as described in the Github readme.

In the Cmakelists.txt of the Rosnode add:

find_package(PahoMqttCpp REQUIRED)

target_link_libraries(${PROJECT_NAME}
  PahoMqttCpp::paho-mqttpp3
)

in the package.xml add:

  <depend>PahoMqtt</depend>

That should be everything to use it in your C++ code.

Upvotes: 1

Related Questions