Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Da cobra

struct & typedef

This topic is 5282 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

Why do I get this error : error C2079: 'artikel' uses undefined struct 'ArtInfo' when I do this :
// type definitie voor een artikel

typedef struct 
{
	char      code[16] ;
	char      naam[80] ;
	float     aankoopprijs ;
	short int aantal ;
} ArtInfo ;

void test() ;

void main()
{
      test() ;
}

void test()
{
      ArtInfo artikel, *pArt ;
}
[\source]

<SPAN CLASS=editedby>[edited by - Da Cobra on March 4, 2004 12:06:57 PM]</SPAN>

Share this post


Link to post
Share on other sites
Advertisement
look above the definition of your struct, you must be missing a ; or something like this because i copied/pasted your code and it compile fine (Linux/gcc3.3.1)

hope that helps !
Matt

Share this post


Link to post
Share on other sites
You need to be aware that C and C++ are different when it comes to typedefs. You have a C program.


typedef struct ArtInfo_t
{
char code[16] ;
char naam[80] ;
float aankoopprijs ;
short int aantal ;
} ArtInfo ;


[edited by - petewood on March 4, 2004 12:36:16 PM]

Share this post


Link to post
Share on other sites
I seem to solved it like this :


// type definitie voor een artikel

typedef struct ArtInfo
{
char code[maxChar] ;
char naam[80] ;
float aankoopprijs ;
short int aantal ;
} ArtInfo ;
[\source]

can any1 explain what''s the difference?

thanx in advance

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
if your using typedef "type" then you need to give it a name like typedef struct ArtInfo

Share this post


Link to post
Share on other sites

  • 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!