Re: C++ compile problems
Re: C++ compile problems
- Subject: Re: C++ compile problems
- From: Chris Ridd <email@hidden>
- Date: Fri, 25 Jun 2004 07:23:37 +0100
On 25/6/04 5:49 am, email@hidden <email@hidden> wrote:
> even when I do a g++ compile in terminal, i get the same errors as in Xcode.
> But the errors seem to be incongruent with C++ programming style. Look at my
> code followed by the errors. Any suggestions would be monumental!!! I have a
> C++ programming class and if I can get the C++ compiler to work I would be in
> heaven.
>
>
> int main () {
> string word[]={"Arizona","walk","government","C++","beach");
> int wordsize = sizeof(word)/sizeof(string), i;
[...]
> main.cpp:13: error: `i' undeclared (first use this function)
Split up that line onto two:
int wordsize = sizeof(word)/sizeof(string);
int i;
Style-wise, I'd write 'sizeof(word)/sizeof(word[0])' in case I ever change
what type the word array holds, but it doesn't really matter.
Geoff's pointed out the problem with the bracket after "beach".
Cheers,
Chris
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.