类 A ,B
机构体 MyStruct
如何在A,B中分别生命两个 MyStruct 的机构体变量?
主要是 MyStruct 该在哪里声明
A.h or B.h or MyStruct.h
我都试过了,都搞不定 ~@~
谢了先~

解决方案 »

  1.   

    MyStruct.h定义MyStruct,
    A.h B.h中include"MyStruct.h"
    应该可以吧?
      

  2.   

    方案:
    MyStruct.h 声明结构体
    A,B中都包含MyStruct.h
      

  3.   

    绝招:两个A,B头文件中都定义另可能是重复头文件包含,这样的话得在MyStruct.h,里面使用#inndef  #define #endif啦
      

  4.   

    不行的
    struct' type redefinition
    ~@~
      

  5.   

    重复头文件包含,这样的话得在MyStruct.h,里面使用#inndef  #define #endif
    #inndef  "MyStruct_h"
    #define "MyStruct_h"
    struct{
    .............
    }
    #endif
      

  6.   

    搞定了
    #infdef  MyStruct_h
    #define MyStruct_h
    struct MyStruct{
      .............
    }
    #endif
    谢谢各位了^@^