I'm trying to create a static library that contains C and C++ functions and then use this library in a C environment. As per Using C++ library in C code, I wrap C functions around C++ functions.
The makefile for the library uses "ar -rvs libNAMEX.a $(OBJECTS)" where OBJECTS contains the object files compiled by gcc or g++ depending on type (GCC version 4.4.1).
I don't encounter any errors when building the library. But when I try to compile a C file (with a cross-compiled version of GCC 4.5.1) that used the library: "gcc -L[PATH TO libNAMEX.a] -lNAMEX ... c_source.c", it gives me errors related to C++ extensions (i.e., "undefined reference to operator new(unsigned long)", "undefined reference to
std::allocator::~allocator()'").
Are there any way around this problem?