Compatible definitions of inline functions for C99 and C++
问题 I have a utility library of C99 code used by C++11 application code. A few inline functions are declared in the C99 style with code explicitly generated in the translation unit like: // buffer.h inline bool has_remaining(void* obj) { ... } // buffer.c extern inline bool has_remaining(void * obj); However, when I try to use has_remaining in the C++ application, I get errors about multiple definitions at link time. It seems that g++ is instantiating the inline code that already exists in the