#ifdef __cplusplus extern "C" { #endif //一段代码 #ifdef __cplusplus } #endif

https://stackoverflow.com/questions/3789340/combining-c-and-c-how-does-ifdef-cplusplus-work

extern C告诉编译器,这段代码用C的方式编译和链接,C++可以调用这段代码

c中没有函数重载,c++编译的目标文件里函数名字和c处理方式编译是不一样的,要兼容c代码。

相关文章:

  • 2021-10-27
  • 2021-11-28
  • 2022-03-02
  • 2021-07-03
  • 2021-11-27
猜你喜欢
  • 2021-08-12
  • 2022-12-23
  • 2022-01-05
  • 2022-12-23
  • 2022-12-23
  • 2021-08-18
  • 2021-12-11
相关资源
相似解决方案