Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我只是花了一些时间试图弄清楚如何在 C++ Rosnode 中使用 Paho Mqtt 库并编写这个以防万一有人遇到同样的问题。
按照 Github 自述文件中的说明安装 Paho 库。
在 Rosnode 的 Cmakelists.txt 中添加:
find_package(PahoMqttCpp REQUIRED) target_link_libraries(${PROJECT_NAME} PahoMqttCpp::paho-mqttpp3 )
在 package.xml 中添加:
<depend>PahoMqtt</depend>
这应该是在您的 C++ 代码中使用它的所有内容。