• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: C++ compile problems
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.


  • Follow-Ups:
    • sizeofA (Re: C++ compile problems)
      • From: Allan Odgaard <email@hidden>
References: 
 >C++ compile problems (From: "email@hidden" <email@hidden>)

  • Prev by Date: Re: C++ compile problems
  • Next by Date: Xcode 1.2 Install Problem
  • Previous by thread: Re: C++ compile problems
  • Next by thread: sizeofA (Re: C++ compile problems)
  • Index(es):
    • Date
    • Thread