"darkstorm" <ma**********@hotmail.com> wrote in message
news:9b*************************@posting.google.co m...
Consider this:
template<typename T_fp>class TRigidBody : public BaseObject
{
public:
.
.
//member functions
.
.
//Current state of the rigid body
typedef struct TRB_state
{
RB_state(){}
TRB_state(){}
//data members
}RB_state;
inline RB_state GetRBState(uint8 state_id) const;
private:
//data members of rigidbody
///<Current state of the rigid body
RB_state m_state[2];
};
template<typename T_fp>
(error)----->inline TRigidBody<T_fp>::RB_state
TRigidBody<T_fp>::GetRBState(uint8 state_id) const
{
return m_state[state_id];
}
When compiling I am getting this error:
error C2143: syntax error : missing ';' before
'TRigidBody<T_fp>::GetRBState'
Somebody please explain it...
After making a number of changes to eliminate other errors (i.e., struct
constructor name, BaseObject, uint8), this compiled with no error in VC++
6.0. However, VS .NET 2003 gave the error that you reported, after first
giving this warning:
warning C4346: 'TRigidBody<T_fp>::RB_state' : dependent name is not a type
prefix with 'typename' to indicate a type
I can't explain the error, but I found that if I made the code a
non-template it compiled. It also compiled if the function body was placed
inside the class definition.
BTW, you don't need a typedef for the struct. That's a C-ism. You can just
use the struct name.
DW