views:

78

answers:

1

Hi everyone,

So I'm working on iPhone and everything is going swell. Except for the last two hours. I was editing some class, then saved and built and suddenly I had tons of errors in another class implementation file. It seems that all the errors have to do with class members (variables) because the only errors I have are "object undeclared", those objects being the class members. Syntax is ok and all, so I believe it isn't anything like that. Did anyone have this problem before?

Example:

Foo.h

@interface Foo : NSObject
{
@private
    int m_1;
    NSString *m_2;
    NSDictionary *m_3;
}

-(id) init;
-(void) dealloc;
-(int) bar;
-(int) barWithFoo:(Foo *)foo;

@end

Foo.m

#import "Foo.h"

@implementation Foo

-(id) init
{
    return self = [super init]; 
}

-(void) dealloc
{
    // code
}

-(int) bar
{
    if (m_1 > MAX_DECL) /* error here, m_1 undeclared */
    {
        // do stuff
    }

    NSLog(m_2); /* error here, m_2 undeclared */
}

// etc...

@end
+1  A: 

A bit unspecific question, it's hard to help with this info available... However, I'd check #import declarations to make sure all files are included. Also, make sure you haven't renamed a class (it can be a typo) and both declaration in .h and definition in .m have the same name.

Gobra
Yes I have checked all #import declarations and the name is correct. Also the files are in the correct folder and I am editing the correct files. I can't really post my whole class implementation file, but basically it's as I have described, btw I have edited the OP.
Ricardo Ferreira
I guess you have tried full rebuild, haven't you? Erase all temporary files manually.
Gobra
Yup, I've cleaned all targets and rebuilt several times.
Ricardo Ferreira
Try to localize the issue. Remove the "problem" class from the project (replace it with a blank) and check whether the project will compile. If yes - insert the problem class into the new empty project and check it step-by-step.
Gobra
This will sound stupid, but I just backup the contents of the files, erased them, saved them, then reverted them to the backup I made and now it works! WTF? Thanks for your help :)
Ricardo Ferreira
@Ricardo Ferreira: Most likely, you had a non-visible non-breaking space or another special character in the file.
swegi