Skip to main content
gamedev.net
🔒 Locked

struct problem need help

Started by kwaung Jan 20, 2005 at 7:31 AM 1 replies 1k views
Original Post
kwaung
kwaung
I have a problem about this 2 structure. //--- Joint structure : Hold joint data -- typedef struct _JOINT_STRUCTURE { int id; //Joints ID int JointType; //Joint Type LPNODE ConnectTo; //point to connecting parts id int status; //connection status }JOINT,*LPJOINT; //--- Body part structure : Hold part data-- typedef struct _NODE_DATA_STRUCTURE { char name[20]; //Parts name int id; //Parts ID int MeshType; //Type of Mesh int NumJoint; //Number of joint LPJOINT joint; //Pointer to joint // position of MEsh --WDL }NODE,*LPNODE; It a syntex error when I complie it. I know it about LPNODE that I use in JOINT struct. because complier dont know what is LPNODE when time of complie JOINT struct. But how I resove this problem? I dont know how to do it. Thanks for help in advance [Edited by - kwaung on January 20, 2005 7:56:38 AM]
snk_kid
snk_kid
You have circular dependency, to resolve you use forward declarations.

typedef struct _NODE_DATA_STRUCTURE* LPNODE;typedef struct _JOINT_STRUCTURE {   LPNODE ConnectTo;} JOINT, *LPJOINT;typedef struct _NODE_DATA_STRUCTURE {   LPJOINT joint;} NODE;


note the declaration of LPNODE has moved

you just reminded me how much i hate hungarian notation or where ever that naming convention comes from. [smile]
kwaung
kwaung
Thanks you for your reply.
About hungarian notation , I hate it too. But it my naming style is worst than MS hungarian notaion. lol

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.