1. 在C和C++的头文件中 都加入
#ifdef __cplusplus
extern "C" {
#endif
#ifdef __cplusplus
}
#endif
C++文件 编译器预定义了
__cplusplus,因此代码里使用了extern "C"
2. 执行上述步骤后,C能调用C++中的函数,C++也能调用C的函数,但是C文件中不能调用 C++中的类对象,因为C模块在编译时,遇到class,就不能识别。