首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

求问关于结构体镶嵌结构体的有关问题

2012-02-17 
求问关于结构体镶嵌结构体的问题我在VS2005中 的一个头文件中:#ifndef __AA_H__#define __AA_H__#ifdef __

求问关于结构体镶嵌结构体的问题
我在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 ,这可怎么解决好那 谢谢
   


[解决办法]

C/C++ code
#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 

热点排行