it did it so many times and i didn\'t had any problems with it, but this time i still getting the error above, my relevant code is this:
#import \"PiecesChoisies
PiecesChoisies
is not recognized as a type. This may happen because it has cyclical dependencies.
The following code example illustrates the problem. Classes A and B create a circular dependency trying to import each other.
#import "B.h" // <-- A imports B
@interface A : NSObject
@end
#import "A.h"
@implementation A
@end
#import "A.h" // <-- and B imports A
@interface B : NSObject
@end
#import "B.h"
@implementation B
@end
Because the classes are never created, the compiler treats them as unknown tokens, so the error shows as Expected specifier-qualifier-list before XXX
. In other words "I expected something meaningful before XXX".
To remove the circular dependency:
@class
) on the interface file. #import
from the interface to the implementation file. The class declaration tells the compiler "don't worry, I'll define this later", so the header becomes safe to import because the conflicting definition is now out of sight on the implementation file.
Here is the result for the previous example:
@class B; // <---- #import "B.h" replaced with @class B
@interface A : NSObject
@end
#import "A.h"
#import "B.h" // <---- #import "B.h" added
@implementation A
@end
And do the same with class B:
@class A; // <---- #import "A.h" replaced with @class A
@interface B : NSObject
@end
#import "B.h"
#import "A.h" // <---- #import "A.h" added
@implementation B
@end