This is not supposed to compile, this is not a valid C syntax.
The standard approach to make C declarations in the header file work in both the C compiler and C ++ is to rely on the preprocessor character, which is defined only in the C ++ compiler. Like this:
#ifdef __cplusplus extern "C" { #endif
Each C ++ compiler defines __cplusplus.
source share