background image

说:C++和 C 对产生的函数名字的处理是不一样的. 目的就是主要实现 C 与 C++的相互调

用问题。

 

c.h 的实现

#ifndef _c_h_

#define _c_h_

#ifdef __cplusplus

extern "C" {

#endif

void C_fun();

#ifdef __cplusplus

}

#endif

#endif

-----------------------------------

c.c 的实现

#include "c.h"

void C_fun()

{

}

------------------------------------

在 cpp.cpp 中调用 c.c 中的 C_fun()

cpp.cpp 的实现

#include "c.h"

int main()

{