struct within multiple struct causing problems

OP #3635304
I have a struct which is beeing included to other struct in other 
modules, such as StructA.StructB.ElementofB is possible.

This is done for multiple modules, and each module has the .h file of 
structB included.  But for some reason am i getting compiler errors 
which says that structB is an undefined type, eventthoug i in my IDE can 
see that it is declarated correctly.

Why is it saying that the type is undefined eventhough i've included the 
.h file??
OP #3635356
typedef struct{
int start;
int stop;
int lap;
} a;


typedef struct{
a A
int car;
int postal;
} loser;



typedef struct{
a A
int don;
int son;
} more;


each struct is in it's own .h file. i've just included .h of struct a on 
all them.
#3635379
I can't find a mistake in the example, i think the problem is somewere 
else. How is the exact structure of the files, in which order are 
#include and #ifdef - #endif and in which files? Try to preprocess the 
files only, then something may be clearer. (gcc -E file.c)
Guest #3638460
John Mayer wrote:
> Well. that's just because i just wrote some random ones here..
> they are added in my code.

You are not supposed to write some random code for this posting, but 
something that you tried and that actually contains the problem you're 
experiencing.

Reply

A question of your own? This thread is over 12 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.