Re: external declares
Re: external declares
- Subject: Re: external declares
- From: Steve Checkoway <email@hidden>
- Date: Sat, 11 Feb 2006 14:11:50 -0800
On Feb 11, 2006, at 12:16 PM, Robert Dell wrote:
the main question was is it something wrong with the compiler or is
it something wrong with me. that's why i asked WHY. why did i
have to declare external variables but not external structures in
the include. should it make sense if i was to be forced to include
one i should be forced to include others?
This is because you've defined struct expskill before you included
reqs.c. As I explained in my last e-mail, you're just copying reqs.c
into that file so struct expskill is already defined when it is used.
As for extern long currentCircle, in your current design, there's no
reason for it to be entern as it does not need external linkage. The
problem is, you need to declare a variable before you use it. For
myarmor, you declared the variable at the same time you defined
struct expskill and you did it _before_ you used it. You have not
done that with long currentCircle.
To recap, types (like structs, enums, and unions) need to be defined
before used [1]. Variables need to be declared before they are used.
- Steve
1. You can use forward declarations 'struct expskill;' rather than
definitions in situations where you only need a pointer (or in C++, a
reference) to a struct.Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden