C++虽然说是和C有一定的兼容,但是在一些用法和混合编程时会出现冲突。
1. C++调用C的头文件最好使用以下方法:
#ifdef __cplusplus
extern "C" {
#endif
#include "xxxxxx.h"
#ifdef __cplusplus
}
#endif
2.C++调用C的函数最好使用以下方法:
#ifdef __cplusplus
extern "C" {
#endif
void xxxxxxx(int AB);
void xxxxxx(char AABB);
#ifdef __cplusplus
}
#endif