extern "C" int
时间: 2023-10-10 15:12:06 浏览: 84
extern "C" int是一种用于在C++代码中声明一个以C语言风格编译的函数或变量的方式。它的作用是告诉编译器将这部分代码按照C语言的规则进行编译,而不是C++的规则。这样做的目的是为了解决C和C++之间的兼容性问题,特别是在C++代码中调用C语言函数的情况下。通过使用extern "C"关键字,我们可以确保C++代码正确地调用被C编译器编译后的函数。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [C语言extern关键字用法和理解](https://blog.csdn.net/qq_27664167/article/details/82859852)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *3* [C++调用C函数,为什么要加extern "C"?](https://blog.csdn.net/linpuliang/article/details/43152597)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文