“collect2: ld returned 1 exit status” Error Iphone SDK. Please help me


i am new Mac and iphone SDK. i writing basicly a game application. and i want to update and show game score using SQLite.

i searched in web for my problem but i didnt find any solution for me. error is:

Ld /Users/Iphone/Desktop/IDRGame/build/Debug-iphonesimulator/IDRGame.app/IDRGame normal i386 cd /Users/Iphone/Desktop/IDRGame setenv MACOSX_DEPLOYMENT_TARGET 10.5 setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.0 -arch i386 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk -L/Users/Iphone/Desktop/IDRGame/build/Debug-iphonesimulator -L/Users/Iphone/Desktop/IDRGame -L/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator2.2.1.sdk/System/Library/Frameworks/QuartzCore.framework -F/Users/Iphone/Desktop/IDRGame/build/Debug-iphonesimulator -F/Users/Iphone/Desktop/IDRGame -filelist /Users/Iphone/Desktop/IDRGame/build/IDRGame.build/Debug-iphonesimulator/IDRGame.build/Objects-normal/i386/IDRGame.LinkFileList -mmacosx-version-min=10.5 -framework Foundation -framework UIKit -framework CoreGraphics -framework AudioToolbox -lsqlite3.0 -o /Users/Iphone/Desktop/IDRGame/build/Debug-iphonesimulator/IDRGame.app/IDRGame Undefined symbols: ".objc_class_name_ScoreDB", referenced from: literal-pointer@__OBJC@__cls_refs@ScoreDB in IDRGameAppDelegate.o literal-pointer@__OBJC@__cls_refs@ScoreDB in InterclockView.o ld: symbol(s) not found collect2: ld returned 1 exit status

i have ScoreDB.h and ScoreDB.m files for SQLite. ScoreDB.h File

// // ScoreDB.h // SQLiteTutorial // // Created by Iphone App on 6/11/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import <UIKit/UIKit.h> #import <sqlite3.h> @interface ScoreDB : NSObject { NSInteger *game_id; NSString *name; NSString *score; BOOL hydrated; BOOL dirty; } @property (nonatomic, readonly) NSInteger *game_id; @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSString *score; @property (nonatomic, readwrite) BOOL dirty; @property (nonatomic, readwrite) BOOL hydrated; - (id)initWithPrimaryKeyNSInteger)pk; -(void)UpdateDatabase; -(void)SelectDatabase; + (void) finalizeStatements; @end

and ScoreDB.m

#import "ScoreDB.h" static sqlite3 *database = nil; static sqlite3_stmt *insert_statement = nil; static sqlite3_stmt *init_statement = nil; static sqlite3_stmt *delete_statement = nil; static sqlite3_stmt *hydrate_statement = nil; static sqlite3_stmt *dehydrate_statement = nil; static sqlite3_stmt *update_statement = nil; @implementation ScoreDB @synthesize game_id,name,score,dirty,hydrated; - (id)initWithPrimaryKeyNSInteger)pk{ [super init]; game_id = pk; return self; } // Finalize (delete) all of the SQLite compiled queries. + (void)finalizeStatements { if (database) sqlite3_close(database); if (insert_statement) { sqlite3_finalize(insert_statement); insert_statement = nil; } if (init_statement) { sqlite3_finalize(init_statement); init_statement = nil; } if (delete_statement) { sqlite3_finalize(delete_statement); delete_statement = nil; } if (hydrate_statement) { sqlite3_finalize(hydrate_statement); hydrate_statement = nil; } if (dehydrate_statement) { sqlite3_finalize(dehydrate_statement); dehydrate_statement = nil; } if (update_statement) { sqlite3_finalize(update_statement); update_statement = nil; } } -(void)UpdateDatabase { delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; [alert show]; if(update_statement == nil) { const char *sql = "UPDATE game Set score = ? Where name = ?"; if(sqlite3_prepare_v2(database, sql, -1, &updateStmt, NULL) != SQLITE_OK) NSAssert1(0, @"Error while creating update statement. '%s'", sqlite3_errmsg(database)); } sqlite3_bind_text(update_statement, 1, [name UTF8String], -1, SQLITE_TRANSIENT); sqlite3_bind_text(update_statement, 2, [score UTF8String], -1, SQLITE_TRANSIENT); // sqlite3_bind_int(update_statement, 3, coffeeID); if(SQLITE_DONE != sqlite3_step(update_statement)) NSAssert1(0, @"Error while updating. '%s'", sqlite3_errmsg(database)); sqlite3_reset(update_statement); //Reclaim all memory here. [score release]; score = nil; [name release]; name = nil; } -(void)SelectDatabase {} - (void) setGameNameNSString *)newValue { [name release]; name = [newValue copy]; } - (void) setGameScoreNSString *)newValue { [score release]; score = [newNumber copy]; } - (void)dealloc { [name release]; [score release]; [super dealloc]; } @end

and i am using that codes

IDRGameAppDelegate *appDelegate = (IDRGameAppDelegate *)[[UIApplication sharedApplication] delegate]; ScoreDB *dbObj = [[ScoreDB alloc] initWithPrimaryKey:0]; dbObj.name = @"reflex"; dbObj.score = @"0.345"; [appDelegate updateScore:dbObj];

when i close this line : ScoreDB *dbObj = [[ScoreDB alloc] initWithPrimaryKey:0]; error is gone. what is problem i dont understand. please help me. my frameworks :

<ul><li>libsqlite3.0.dylib</li> <li>AudioToolbox.framework</li> <li>UIkit.framework</li> <li>Foundation.framework</li> <li>CoreGraphics.framework.</li> </ul>

i hope u can help me.

Thanks everyone.


You probably have not added ScoreDB.m to the current target. Right-click ScoreDB.m, select "Get Info", select the "Targets" tab and make sure it's part of the target you're building.


  • How to convert .docx to .doc using apache poi
  • Excel file access from internal storage android app
  • Google Maps display province lines
  • Objects follow responsive background-image
  • POI DataFormatter returns 2 digits year instead of 4 digits year for date cells
  • Apache POI : Difference between row.getLastCellNum and row.getNoOfPhysicalCell
  • Reflect Data in the Excel sheet to the android app
  • Java Apache Poi SXSSF with Excel Macros
  • Convert HTML page into MS word using java
  • How to split a .doc into several .doc using JAVA POI?
  • django point definition
  • Parse xlsx file row by row into String[]
  • Apache Poi excel remove blank rows
  • Generating Powerpoint PPT with ColdFusion?
  • Cannot install sqlite3 gem
  • How to convert ordinary java Color to IndexedColors
  • How to Generate DataXML in OpenXML for powerpoint in java
  • Integrating excel sheet with java swing
  • adding jar in Jcreator
  • Copy PowerPoint Slides in Java (preferably)
  • Pyspark window function with condition
  • Is there a difference in these javascript include definitions
  • How can I programatically convert .xls and .csv files to .xlsx?
  • MySQL Query Tuning - Why is using a value from a variable so much slower than using a literal?
  • Greek letters in a GUI - PYTHON
  • cast stl::vector containing pointers to stl::vector containing constant pointers
  • How to read xlsx file in an android application?
  • What's the benefit of the trailing apostrophe in character literals
  • How to solve “The hierarchy of the type is inconsistent” error in Java Eclipse?
  • Objective-C : getting error on console while trying to display app on ipad device?
  • Is it possible to extract table infomation using Apache Tika?
  • SQL Server Nvarchar and Java prepared statement
  • How do I know what reference to include to import a specific .NET namespace?
  • Sort by a column in a union query in SqlAlchemy SQLite
  • Google Player Game Service Error: Can't build the sample game
  • Sympy: working with equalities manually
  • SAXReader not re-ecape characters
  • How to revert to previous XCode version?
  • XCode can't find symbols for a specific iOS library/framework project
  • Error creating VM instance in Google Compute Engine