1.混合编译出现的问题
(1)引用了未定义的函数:这是由于C和C++编译阶段对函数的命名方式不同。
解决方案:在被调用的函数(由C调C++的或C++调用C的函数)所声明的头文件中加入下面的代码
#ifdef __cplusplus
extern "C" {
#endif
//混合的函数
void display();
#ifdef __cplusplus
}
#endif
参考来源:extern "C":实现C++和C的混合编程 (biancheng.net)
2.进阶混编