2 Replies - 1600 Views - Last Post: 15 June 2012 - 02:48 AM

#1 choochoo9  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 15-June 12

error: expected '=',',',';', 'asm' or

Posted 15 June 2012 - 02:33 AM

Hello I am getting this error:
error: expected '=',',',';', 'asm' or '__attribute__' before '.' token

I am not sure what is causing it, it's probably something stupid which I have over looked, here is the problem code.
This is a mac app btw

DataClass *obj=[DataClass getInstance];
obj.str= @"test";
Is This A Good Question/Topic? 0
  • +

Replies To: error: expected '=',',',';', 'asm' or

#2 mccabec123  Icon User is offline

  • D.I.C Head

Reputation: 18
  • View blog
  • Posts: 225
  • Joined: 03-March 11

Re: error: expected '=',',',';', 'asm' or

Posted 15 June 2012 - 02:40 AM

Please use code tags, and also post the entire function that's causing problems, as it's hard for people to get an idea of what your program is actually trying to do.
Was This Post Helpful? 0
  • +
  • -

#3 choochoo9  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 15-June 12

Re: error: expected '=',',',';', 'asm' or

Posted 15 June 2012 - 02:48 AM

Sorry I'm new to the forums, here is the header and main to the related code.
mod: removed code

Can you remove the last post as I pasted the wrong code.
This is the correct code.

//DataClass.h

@interface DataClass : NSObject {    

NSString *str;     

}    
@property(nonatomic,retain)NSString *str;    
+(DataClass*)getInstance;    
@end  




//DataClass.m
@implementation DataClass    
@synthesize str;    
static DataClass *instance =nil;    
+(DataClass *)getInstance    
{    
    @synchronized(self)    
    {    
        if(instance==nil)    
        {    

            instance= [DataClass new];    
        }    
    }    
    return instance;    
}    

This post has been edited by modi123_1: 15 June 2012 - 07:08 AM
Reason for edit:: removed code per report

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1