#if defined(__cplusplus)
extern "C" {
#endif
typedef struct Node { int n;}Node ;
// 在这里面写
#if defined(__cplusplus)
}
#endif就可以c++用c了
如果 xx.c
Node g_node;
c++文件中cppsource.cc
extern Node g_node;这样是会链接失败的~~
extern "C" Node g_node;或这在头文件包起来的地方写上这个变量声明

3933

被折叠的 条评论
为什么被折叠?



