• 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: Compile error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile error


  • Subject: Re: Compile error
  • From: James Gregurich <email@hidden>
  • Date: Sun, 8 Apr 2007 09:12:43 -0700


you only allocate class instances by pointer in objc.


On Apr 8, 2007, at 9:04 AM, Hrishikesh Muruk wrote:

Hi

I am a complete novice at Objective-c (But I do have reasonable coding experience in C/C++).

I get the following compile error for a class I defined

"error: statically allocated instance of Objective-C class"

Class:
foo.h
@interface foo : NSObject {

    @protected
    NSString name;

}
-(void) doNothing;
@end

foo.m
@implementation foo
- (void) doNothing {
}
@end

The error goes away when I change name to "NSString* name".

Can I only declare object pointers in Objective-C? Just plain objects are not allowed?

Thanks
Hrishi

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
40mac.com


This email sent to email@hidden

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Compile error (From: Hrishikesh Muruk <email@hidden>)

  • Prev by Date: [Cocoa Bundle] NSString To JavaScript
  • Next by Date: Re: [Cocoa Bundle] NSString To JavaScript
  • Previous by thread: Compile error
  • Next by thread: [Cocoa Bundle] NSString To JavaScript
  • Index(es):
    • Date
    • Thread