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

Isn't this just a regular C++ mangles C symbols but the library exports non-mangled symbols?

Is the waveshare lib plain C, or does it use C++? If the former, you need to enclose the #includes of the waveshare's headers with extern "C" { ... }, to prevent the C++ compiler from mangling all the function names and the linker then not being able to find them in the library.

Note: this is not special or specific to ROS 2, it's always a problem when linking C with C++.

Isn't this just a regular C++ mangles C symbols but the library exports non-mangled symbols?symbols problem?

Is the waveshare lib plain C, or does it use C++? If the former, you need to enclose the #includes of the waveshare's headers with extern "C" { ... }, to prevent the C++ compiler from mangling all the function names and the linker then not being able to find them in the library.

Note: this is not special or specific to ROS 2, it's always a problem when linking C with C++.

Isn't this just a regular C++ mangles C symbols but the library exports non-mangled symbols problem?

Is the waveshare lib plain C, or does it use C++? If the former, you need to enclose the #includes of the waveshare's headers with extern "C" { ... }, to prevent the C++ compiler from mangling all the function names and the linker then not being able to find them in the library.

Note: this is not special or specific to ROS 2, it's always a problem when linking C with C++.

See #q227146 and #q381206 for similar issues.