我有这样的事情:
union MyBBox3D
{
struct
{
float m_fBox[6];
float m_fCenter[3];
float m_fDiagonalLen;
float m_fNormalizeFactor;
float m_fScaling[3];
};
struct
{
float m_fMin[3];
float m_fMax[3];
float m_fCenter[3];
float m_fDiagonalLen;
float m_fNormalizeFactor;
float m_fScaling[3];
};
struct
{
float m_fMinX, m_fMinY, m_fMinZ;
float m_fMaxX, m_fMaxY, m_fMaxZ;
float m_fCenterX, m_fCenterY, m_fCenterZ;
float m_fDiagonalLen;
float m_fNormalizeFactor;
float m_fScalingX, m_fScalingY, m_fScalingZ;
};
};
它用vs2008和intel编译器12.0编译得很好,但不能用gcc4.6.3编译,它给出了以下错误:
In file included from Mesh/MyMeshTool.cpp:17:0:
Mesh/MyMeshTool.h:68:28: error: declaration of ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fCenter [3]’
Mesh/MyMeshTool.h:59:28: error: conflicts with previous declaration ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fCenter [3]’
Mesh/MyMeshTool.h:69:17: error: declaration of ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fDiagonalLen’
Mesh/MyMeshTool.h:60:17: error: conflicts with previous declaration ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fDiagonalLen’
Mesh/MyMeshTool.h:70:20: error: declaration of ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fNormalizeFactor’
Mesh/MyMeshTool.h:61:20: error: conflicts with previous declaration ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fNormalizeFactor’
Mesh/MyMeshTool.h:71:32: error: declaration of ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fScaling [3]’
Mesh/MyMeshTool.h:62:32: error: conflicts with previous declaration ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fScaling [3]’
Mesh/MyMeshTool.h:78:17: error: declaration of ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fDiagonalLen’
Mesh/MyMeshTool.h:60:17: error: conflicts with previous declaration ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fDiagonalLen’
Mesh/MyMeshTool.h:79:20: error: declaration of ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fNormalizeFactor’
Mesh/MyMeshTool.h:61:20: error: conflicts with previous declaration ‘float nsMeshLib::MyBBox3D::<anonymous struct>::m_fNormalizeFactor’
我怎么解决这个问题?提前致谢!