我知道有很多类似的问题,有点我没有找到我的案例:
我有:
#import <Foundation/Foundation.h>
@interface BSConstants : NSObject
extern NSString* const DB_COLUMN_NAME;
extern NSString* const DB_COLUMN_PRICE;
extern NSString* const DB_COLUMN_DESCRIPTION;
extern NSString* const DB_COLUMN_ICON;
extern NSString* const DB_COLUMN_IMAGE;
@end
#import "BSConstants.h"
@implementation BSConstants
NSString* const DB_COLUMN_NAME = @"name";
NSString* const DB_COLUMN_PRICE = @"price";
NSString* const DB_COLUMN_DESCRIPTION = @"description";
NSString* const DB_COLUMN_ICON = @"icon";
NSString* const DB_COLUMN_IMAGE = @"image";
@end
当我尝试构建我的项目时 - 我得到:
Undefined symbols for architecture i386:
"_CONST_SHOPPING_CART_PURCHASE_MAX_SIZE", referenced from:
-[BSShoppingCartViewController onBuyButtonPressed:] in BSShoppingCartViewController.o
"_NAME_CREATED_FILE", referenced from:
-[BSImageSaver saveImageAsPng:] in BSImageSaver.o
"_NAME_DOWNLOADS_FOLDER", referenced from:
-[BSImageSaver saveImageAsPng:] in BSImageSaver.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
尝试访问:
#import "BSConstants.h"
... DB_COLUMN_NAME