C++ 编译报错

vs编译错误描绘如下:

1>f:company ewphonesoftphoneservicesoftphoneserviceEventS.h(13): error C2143: 语法错误 : 缺少“;”(在“*”的前面)
1>f:company ewphonesoftphoneservicesoftphoneserviceEventS.h(13): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int
1>f:company ewphonesoftphoneservicesoftphoneserviceEventS.h(13): error C4430: 缺少类型说明符 - 假定为 int。注意: C++ 不支持默认 int

错误定位到声明处,错误原因:

在一个类中包含(include)另一个类,而另一个中也包含了这个类。所以需要用声明的方式。不然出错(CAgent和CEventS)

namespace SPS
{
class CAgent;
class CEventS
{
public:
 
 char event[1024*3+1];
 char attEvent[1024*3+1];
  CAgent* pa;
 //CAgent* pb;
public:
 CEventS(void);
 ~CEventS(void);
};
}//namespace sps

原文地址:https://www.cnblogs.com/wflxz/p/5774027.html