Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective C and gcc problems



On Monday, June 18, 2001, at 03:36 PM, Daniel J. Luke wrote:

On Mon, Jun 18, 2001 at 02:53:24PM -0400, Andre John Mas wrote:
I have just been following the tutorial in the "Learning Cocoa" book and
had problems with the follow code:

int main (int argc, const char * argv[])
{
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSMutableArray *myArray = [[NSMutableArray alloc] init];

[myArray addObject: @"Here's a string"];

int itemCount;

The problem is here. You need to declare your variables at the beginning of a block in C (and thus in Objective C as well).

Move int itemCount;

Thanks, for this. Since I have spent the past few years in Java
and C++, I didn't think about that possibility.

Andre

--
mailto:email@hidden


References: 
 >Re: Objective C and gcc problems (From: "Daniel J. Luke" <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.