在 main.CI 中,我尝试访问嵌套结构成员(g.Fp1.d_status)并收到错误消息:
'g.GridPt::Fp1' 没有类类型
下面是我的代码。我真的可以使用一些帮助。谢谢。我尝试了诸如 g.MarchingDirection::Fp1.d_status, g.&MarchingDirection::Fp1.d_status, ... 之类的东西,但没有成功。
//Filename: main.C
#include "GridPt.h"
int main()
{
GridPt g;
g.d_lstDistFn;
g.Fp1.d_status; \\ERROR: 'g.GridPt::Fp1' does not have class type
return 0;
}
//Filename: MarchingDirection.h
#ifndef included_MarchingDirection
#define included_MarchingDirection
struct MarchingDirection
{
MarchingDirection(double FValue);
double d_F;
int d_inOut;
char d_status;
};
#endif
//Filename: MarchingDirection.C
#include "MarchingDirection.h"
MarchingDirection::MarchingDirection(double FValue)
: d_F(FValue),
d_inOut(static_cast<int>(FValue)),
d_status('d'){}
//Filename: Grid2D.h
#ifndef included_GridPt
#define included_GridPt
#include "MarchingDirection.h"
#include <cstddef>
struct GridPt
{
GridPt();
double d_x, d_y;
MarchingDirection Fp1(double F=1.0), Fm1(double F=-1.0);
double d_lstDistFn;
};
#endif
//Filename: GridPt.C
#include "GridPt.h"
GridPt::GridPt()
: d_lstDistFn(0.0){}