Xcode构建错误(新手)

时间:2011-03-07 19:56:49

标签: objective-c xcode

这是我的代码:

(来自SQLiteDB.h)

#import <sqlite3.h>


@interface SQLiteDB : NSObject {

    NSString *dbPath;
    int databaseKey;
    sqlite3 *db;
}

//@property (nonatomic, copy) NSString *db;
@property (nonatomic, copy) NSString *dbPath;
@property (nonatomic) sqlite3 *db;
@property (nonatomic) int databaseKey;
@end

=============== (来自SQLiteDB.m)

#import "SQLiteDB.h"


@implementation SQLiteDB
@synthesize db, dbPath, databaseKey;
@end

=============== (来自SampleAppDelegate.m)

#import "ReaderSampleAppDelegate.h"
#import "ReaderSampleViewController.h"

@implementation ReaderSampleAppDelegate

@synthesize window;
@synthesize viewController;


#pragma mark -
#pragma mark Application lifecycle


- (void)applicationDidFinishLaunching:(UIApplication *)application
{
    //  create the d/b or get the connection value
    SQLiteDB *dbInstance = [[SQLiteDB alloc] init];  //  Error here  <---------
}

==================

错误是:SQLiteDB未声明。

我以为我在SQLiteDB.h中声明了它?我该如何解决这个问题?

5 个答案:

答案 0 :(得分:1)

使用

#import "SQLiteDB.h" 
SampleAppDelegate.m中的

答案 1 :(得分:0)

SampleAppDelegate.m中包含以下行:

#import "SQLiteDB.h"

答案 2 :(得分:0)

你需要:

#import "SQLiteDB.h" in SampleAppDelegate.m or .h

答案 3 :(得分:0)

您需要#import SQLiteDB.h进入SampleAppDelegate.m

答案 4 :(得分:0)

您可能需要在SampleAppDelegate.m

#import "SQLiteDB.h"