I have a static library with C++ internals but with a C wrapper so that C code can call the library.
- Using g++, no issue.
- Using gcc, I get lots of
undefined reference to
at the library's internal functions. - The C code calls only the C functions in the C wrapper.
- The problem is from internal calls inside the library not to the "API".
The C wrapper contains:
#ifdef __cplusplus
extern "C" {
#endif
Why? Can we link a static library containing C++ but exposing only C functions to a C application?
What's the point of writing a C wrapper for a C++ library if we still need to compile the C code as C++?