//CA.h
#include "CB.h"
Class CA:public CDialog
{
public:
      CString gun;
}
///////////
//CA.cpp……
///////////
//CB.h
#include "CA.h" //这里是不是不能包含CA.h了
class CB:public CDialog
{   
  
}
//CB.cpp
#include "CA.h"
 gun="AK47";//这里用到CA里定义的gun时编译提示gun未定义,什么意思,为什么//会这样,

解决方案 »

  1.   

    不可以//CA.h
    #include "CB.h"
    Class CA:public CDialog
    {
    public:
          CString gun;
          CB m_CB;//可以定义一个CB
    }
    ///////////
    //CA.cpp……
    ///////////
    //CB.h
    //#include "CA.h" //这里是不是不能包含CA.h了
    class CA;
    class CB:public CDialog
    {   
      CA* m_pCA;//只能定义指针,因为你用的是Class CA;不是Include "ca.h"
    }
    //CB.cpp
    #include "CA.h"
     m_pCA=new CA();
     m_pCA->gun="AK47";
    // gun="AK47";//这里用到CA里定义的gun时编译提示gun未定义,什么意思,为什么会这样,