Skip to content

C++ Doxygen has broken examples #593

@judfs

Description

@judfs

https://lcm-proj.github.io/lcm/doxygen_output/c_cpp/html/classlcm_1_1LCM.html#aa18a362fee1eae7e84387eea98c2575f

#include <lcm/lcm-cpp.hpp>
 
void onMessage(const [lcm::ReceiveBuffer](https://lcm-proj.github.io/lcm/doxygen_output/c_cpp/html/structlcm_1_1ReceiveBuffer.html)* rbuf, const std::string& channel, void*) {
  // do something with the message.  Raw message bytes are
  // accessible via rbuf->data
}
 
int main(int argc, char** argv) {
  LCM::lcm lcm;
  lcm.subscribe("CHANNEL", onMessage, NULL);
  while(true)
    lcm.handle();
  return 0;
}

Replace the contents of examples/cpp/listener.cpp with the above and you get

lcm/examples/cpp/listener.cpp:9:3: error: ‘LCM’ has not been declared
    9 |   LCM::lcm lcm;

Fix it to lcm::LCM lcm and then you get:

lcm/examples/cpp/listener.cpp:10:16: error: no matching function for call to ‘lcm::LCM::subscribe(const char [8], void (&)(const lcm::ReceiveBuffer*, const string&, void*), NULL)’
   10 |   lcm.subscribe("CHANNEL", onMessage, NULL);

I suspect there's more where this is found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions