求问关于结构体镶嵌结构体的问题
我在VS2005中 的一个头文件中:
#ifndef __AA_H__
#define __AA_H__
#ifdef __cplusplus
extern 'C'
{
#endif
typdef struct aa {
int pa;
int *ba;
}aa_ex;
typdef struct bb {
int pb;
int bb[20];
}bb_ex;
typedef struct cc{
int c1;
aa_ex c1;
bb_ex c2;
}
#ifdef __cplusplus
}
#endif
#endif
就是这么一个简单的结构体,结构体cc镶嵌了 结构体aa和bb 但是竟然 cc定义中的结构体识别不出来结构体aa和bb ,这可怎么解决好那 谢谢
[解决办法]
#ifndef __AA_H__ #define __AA_H__ #ifdef __cplusplus // "C" not 'C'extern "C"{ #endif // typedef not typdeftypedef struct aa { int pa; int *ba; }aa_ex; typedef struct bb { int pb; // bb?? int b[20]; }bb_ex; typedef struct cc{ // 两个c1? int c0; aa_ex c1; bb_ex c2; };#ifdef __cplusplus } #endif #endif