c++里面用c语言的标准库的时候, 包含的c的标准头文件是不是自动extern "C"了.
比如 :
#include <string.h> #include <stdio.h> 是不是自动处理过了,可以用c的编译链接约定去找到并链接c标准库的函数?
拥有18年软件开发和IT教学经验。曾任多家上市公司技术总监、架构师、项目经理、高级软件工程师等职务。 网络人气名人讲师,...
Yes, you can check the header file yourself and it is easy to find the following code
#ifdef __cplusplus extern "C" { #endif ... ... #ifdef __cplusplus } #endif
If it is a c standard library, it is best to import it like this:
#include <cstring> #include <cstdio>
This will help you deal with some problems such as function polymorphism
Don’t worry about this, C++ is compatible with most C. As for linking dynamic libraries, the compiler has already done it for you
Yes, you can check the header file yourself and it is easy to find the following code
If it is a c standard library, it is best to import it like this:
This will help you deal with some problems such as function polymorphism
Don’t worry about this, C++ is compatible with most C. As for linking dynamic libraries, the compiler has already done it for you