C++支持函数重载,符号表里的名字并不是函数名。
若C++使用C头文件,会找不到具体函数(C不支持函数重载)。
C头文件应该这样写:
#ifdef __cpluscplus
extern "C" {
#endif
//some code
#ifdef __cplusplus
}
#endif
如果C头文件已经写了,可以这样:
extern "C" {
#include "test_extern_c.h"
}
C++支持函数重载,符号表里的名字并不是函数名。
若C++使用C头文件,会找不到具体函数(C不支持函数重载)。
C头文件应该这样写:
#ifdef __cpluscplus
extern "C" {
#endif
//some code
#ifdef __cplusplus
}
#endif
如果C头文件已经写了,可以这样:
extern "C" {
#include "test_extern_c.h"
}