Original Post
The following was compiled with g++ (GCC) 3.4.2 (mingw-special). The error message that I get upon compilation is ... error: aggregate `nmEzGeom::clVector_3d vec' has incomplete type and cannot be defined It has happening in the call from the getVectorX() function inside the point class. I have no idea on how to resolve this error. I think it has something to do with the forward declaration of the vector class in the point class, but I'm not sure. Any advice would be appreciated. Thanks. [/source][/source] [/source][/source] [/source][/source]
[SOURCE]
//
// main.cpp
//
#include "clPoint_3d.h"
#include "clVector_3d.h"
using namespace nmEzGeom;
int main()
{
return 0;
}
[/SOURCE][SOURCE]
//
// clPoint_3d.h
//
#pragma once
namespace nmEzGeom
{
// Forward declaration to access the 3d vector class.
class clVector_3d;
class clPoint_3d
{
protected:
//
// Member Variables
//
double point_3d[4];
public:
clPoint_3d(); // Default Constructor
inline const double getVectorX() const; // getVectorX
};
// *************************************************************************
// Default Constructor
// *************************************************************************
clPoint_3d::clPoint_3d()
{
this->point_3d[0] = 0.0; // x
this->point_3d[1] = 0.0; // y
this->point_3d[2] = 0.0; // z
this->point_3d[3] = 1.0; // w
}
// *************************************************************************
// getVectorX
// *************************************************************************
inline const double clPoint_3d::getVectorX() const
{
clVector_3d vec;
return vec.getX();
}
} // nmEzGeom
[/SOURCE][SOURCE]
//
// clVector_3d.cpp
//
#pragma once
namespace nmEzGeom
{
class clVector_3d
{
protected:
double vector_3d[4];
public:
clVector_3d(); // Default Constructor
inline const double getX() const; // getX
};
// *************************************************************************
// Default Constructor
// *************************************************************************
clVector_3d::clVector_3d()
{
this->vector_3d[0] = 0.0; // x
this->vector_3d[1] = 0.0; // y
this->vector_3d[2] = 0.0; // z
this->vector_3d[3] = 0.0; // w
}
// *************************************************************************
// getX
// *************************************************************************
inline const double clVector_3d::getX() const
{
return this->vector_3d[0];
}
} // nmEzGeom
[/SOURCE]