简体   繁体   English

Xcode构建错误(新手)

[英]Xcode Build errors (newbie)

Here's my code: 这是我的代码:

(from SQLiteDB.h) (来自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

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

#import "SQLiteDB.h"


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

=============== (from SampleAppDelegate.m) ==============(来自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  <---------
}

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

Error is: SQLiteDB undeclared. 错误是:未声明SQLiteDB。

I thought I did declare it in SQLiteDB.h? 我以为我确实在SQLiteDB.h中声明了它? How do I fix this? 我该如何解决?

use 采用

#import "SQLiteDB.h" 

in SampleAppDelegate.m 在SampleAppDelegate.m中

SampleAppDelegate.m包括以下行:

#import "SQLiteDB.h"

你需要:

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

您需要#import SQLiteDB.h到SampleAppDelegate.m中

您可能需要在SampleAppDelegate.m中#import "SQLiteDB.h"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM