Jump to content
  • Advertisement
Sign in to follow this  
justcallmedrago

Class/Struct inside another

This topic is 3906 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

struct OBJECTDATA;

struct OBJECT{
	OBJECTDATA data;
};

struct OBJECTDATA{
	LPD3DXMESH mesh;
	D3DMATERIAL9* material;
	LPDIRECT3DTEXTURE9* texture;
	DWORD numOfMaterials;
};
I would like to put my struct definitions in this order. It works in the other order. The compiler gives "'OBJECT::data' uses undefined struct 'OBJECTDATA'". How can I make this work? I'd rather not have "OBJECTDATA *data" instead unless there isn't any other solution.

Share this post


Link to post
Share on other sites
Advertisement
You can't. You need to have the complete definition of the class available in order to declare member variables of the type. Just define the OBJECTDATA first.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!