I had a post going sometime before this error .. But could nt follow up on it.. Pardon me for that.. I am trying to do a bit of forward declarations in my program and wrote a couple of classes but then I run into this error which I do not seem to solve
src/BaseBodyDynamics.cpp: In member function 'void Xlib::BaseDynamics::State::RecalculateState()':
src/BaseBodyDynamics.cpp:15: error: invalid use of incomplete type 'struct Xlib::Quatf'
include/BaseBodyDynamics.h:21: error: forward declaration of 'struct Xlib::Quatf'
Pardon me if it is somethin trivial but then it would be nice for someone to chip in with a answer to why this is happening
..
I jus compiled all the code that I thought could be causing the error..
1 2 3 4 5 6 7 8 9 10 11 12 13 14
//test.h
class Quatf;
class Test{
//ctor
Test();
//dtor
~Test() ;
public:
struct state{
Quatf* myvariable;
void recalculate();
}
}
//Quaternion.h
template < class T>
class Quat
{
T x;
T y;
T z;
T w;
Quat(T _x, T _y,T _z, T _r) : x (_x),y(_y),z(_z),w(_w){}
Quat<T>& normalize();
T length();
};
inline Quat<T>& Quat<T>::normalize()
{
if ( T l = length() ) { r /= l; v /= l; }
return *this;
}
inline T Quat<T>::length()
{
return sqrt(x*x+y*y+z*z+w*w);
}
typedef Quat<float> Quatf;
oops.. sorry to have not put it ere.. i have included it in the actual file.. i jus wrote a quick snippet of my code because i did nt want to spam the forum with all my codes.. will edit the above