Using #import or #include

In documentation:"Objective-C adds the #import directive, which does the same thing, except that it knows not to insert a file which has already been inserted."

But I'm get a error, when try:

// ClassA.h
#import <Foundation/Foundation.h>
int SOME_VARIABLE = 1;
@interface ClassA : NSObject {
}
@end
--------------------------------------------------------
// ClassB.h
#import <Foundation/Foundation.h>
#import "ClassA.h"
@interface ClassB : NSObject {
}
@end


And get ERROR: duplicate symbol SOME_VARIABLE

MacBook m403, Mac OS X (10.5.5)

Posted on Feb 27, 2009 12:38 PM

Reply
1 reply

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Using #import or #include

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.