我在Swift项目中添加了FMDB并遵循FMDB Swift指令(即复制相关的.h / m。文件并创建包含import语句的桥接头)。当我尝试编译时,我得到了大量的错误,所有这些都是Apple Match-O-Linker错误......
Undefined symbols for architecture x86_64:
"_sqlite3_bind_blob", referenced from:
-[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
"_sqlite3_bind_double", referenced from:
-[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
"_sqlite3_bind_int", referenced from:
-[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
"_sqlite3_bind_int64", referenced from:
-[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
"_sqlite3_bind_null", referenced from:
-[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
"_sqlite3_bind_parameter_count", referenced from:
-[FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
"_sqlite3_bind_parameter_index", referenced from:
-[FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
"_sqlite3_bind_text", referenced from:
-[FMDatabase bindObject:toColumn:inStatement:] in FMDatabase.o
"_sqlite3_busy_handler", referenced from:
-[FMDatabase setMaxBusyRetryTimeInterval:] in FMDatabase.o
"_sqlite3_changes", referenced from:
-[FMDatabase changes] in FMDatabase.o
"_sqlite3_close", referenced from:
-[FMDatabase close] in FMDatabase.o
"_sqlite3_column_blob", referenced from:
-[FMResultSet dataForColumnIndex:] in FMResultSet.o
-[FMResultSet dataNoCopyForColumnIndex:] in FMResultSet.o
"_sqlite3_column_bytes", referenced from:
-[FMResultSet dataForColumnIndex:] in FMResultSet.o
-[FMResultSet dataNoCopyForColumnIndex:] in FMResultSet.o
"_sqlite3_column_count", referenced from:
-[FMResultSet columnCount] in FMResultSet.o
-[FMResultSet columnNameToIndexMap] in FMResultSet.o
-[FMResultSet kvcMagic:] in FMResultSet.o
-[FMResultSet resultDictionary] in FMResultSet.o
"_sqlite3_column_double", referenced from:
-[FMResultSet doubleForColumnIndex:] in FMResultSet.o
"_sqlite3_column_int", referenced from:
-[FMResultSet intForColumnIndex:] in FMResultSet.o
"_sqlite3_column_int64", referenced from:
-[FMResultSet longForColumnIndex:] in FMResultSet.o
-[FMResultSet longLongIntForColumnIndex:] in FMResultSet.o
"_sqlite3_column_name", referenced from:
-[FMResultSet columnNameToIndexMap] in FMResultSet.o
-[FMResultSet kvcMagic:] in FMResultSet.o
-[FMResultSet resultDictionary] in FMResultSet.o
-[FMResultSet columnNameForIndex:] in FMResultSet.o
"_sqlite3_column_text", referenced from:
-[FMResultSet kvcMagic:] in FMResultSet.o
-[FMResultSet stringForColumnIndex:] in FMResultSet.o
-[FMResultSet UTF8StringForColumnIndex:] in FMResultSet.o
"_sqlite3_column_type", referenced from:
-[FMResultSet stringForColumnIndex:] in FMResultSet.o
-[FMResultSet dateForColumnIndex:] in FMResultSet.o
-[FMResultSet dataForColumnIndex:] in FMResultSet.o
-[FMResultSet dataNoCopyForColumnIndex:] in FMResultSet.o
-[FMResultSet columnIndexIsNull:] in FMResultSet.o
-[FMResultSet UTF8StringForColumnIndex:] in FMResultSet.o
-[FMResultSet objectForColumnIndex:] in FMResultSet.o
...
"_sqlite3_create_function", referenced from:
-[FMDatabase makeFunctionNamed:maximumArguments:withBlock:] in FMDatabase.o
"_sqlite3_data_count", referenced from:
-[FMResultSet resultDict] in FMResultSet.o
-[FMResultSet resultDictionary] in FMResultSet.o
"_sqlite3_errcode", referenced from:
-[FMDatabase lastErrorCode] in FMDatabase.o
-[FMDatabase errorWithMessage:] in FMDatabase.o
-[FMResultSet hasAnotherRow] in FMResultSet.o
"_sqlite3_errmsg", referenced from:
-[FMDatabase lastErrorMessage] in FMDatabase.o
-[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMResultSet nextWithError:] in FMResultSet.o
"_sqlite3_exec", referenced from:
-[FMDatabase executeStatements:withResultBlock:] in FMDatabase.o
"_sqlite3_finalize", referenced from:
-[FMDatabase close] in FMDatabase.o
-[FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMStatement close] in FMDatabase.o
-[FMDatabase(FMDatabaseAdditions) validateSQL:error:] in FMDatabaseAdditions.o
"_sqlite3_free", referenced from:
-[FMDatabase executeStatements:withResultBlock:] in FMDatabase.o
"_sqlite3_last_insert_rowid", referenced from:
-[FMDatabase lastInsertRowId] in FMDatabase.o
"_sqlite3_libversion", referenced from:
+[FMDatabase sqliteLibVersion] in FMDatabase.o
"_sqlite3_next_stmt", referenced from:
-[FMDatabase close] in FMDatabase.o
"_sqlite3_open", referenced from:
-[FMDatabase open] in FMDatabase.o
"_sqlite3_open_v2", referenced from:
-[FMDatabase openWithFlags:] in FMDatabase.o
"_sqlite3_prepare_v2", referenced from:
-[FMDatabase executeQuery:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMDatabase(FMDatabaseAdditions) validateSQL:error:] in FMDatabaseAdditions.o
"_sqlite3_reset", referenced from:
-[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMStatement reset] in FMDatabase.o
"_sqlite3_sleep", referenced from:
_FMDBDatabaseBusyHandler in FMDatabase.o
"_sqlite3_step", referenced from:
-[FMDatabase executeUpdate:error:withArgumentsInArray:orDictionary:orVAList:] in FMDatabase.o
-[FMResultSet nextWithError:] in FMResultSet.o
"_sqlite3_threadsafe", referenced from:
-[FMDatabase initWithPath:] in FMDatabase.o
+[FMDatabase isSQLiteThreadSafe] in FMDatabase.o
"_sqlite3_user_data", referenced from:
_FMDBBlockSQLiteCallBackFunction in FMDatabase.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
我添加的FMDB文件是:
FMDatabase.h
FMDatabase.m
FMDatabaseAdditions.h
FMDatabaseAdditions.m
FMDatabasePool.h
FMDatabasePool.m
FMDatabaseQueue.h
FMDatabaseQueue.m
FMDB.h
FMResultSet.h
FMResultSet.m
有人可以告诉我我做错了吗?
答案 0 :(得分:4)
没关系任何人!我解决了我必须通过项目设置中的Build Phases页面将libsqlite3.dylib链接到我的项目中。到目前为止,我的项目中没有框架组,因此有点令人困惑。
答案 1 :(得分:0)
您的项目 - >一般 - >链接的框架和库您可以添加此libsqlite3.0.tbd。 现在可以构建您的项目和框架。
答案 2 :(得分:0)
如果你有这样的错误信息:
Apple Mach-O Linker (ld) Error Group
"_sqlite3_column_type", referenced from:
"_sqlite3_column_double", referenced from:
"_sqlite3_column_int", referenced from:
"_sqlite3_column_blob", referenced from:
"_sqlite3_data_count", referenced from:
"_sqlite3_column_count", referenced from:
"_sqlite3_create_function", referenced from:
"_sqlite3_user_data", referenced from:
"_sqlite3_exec", referenced from:
"_sqlite3_step", referenced from:
"_sqlite3_prepare_v2", referenced from:
"_sqlite3_threadsafe", referenced from:
"_sqlite3_bind_null", referenced from:
"_sqlite3_column_name", referenced from:
"_sqlite3_errcode", referenced from:
"_sqlite3_bind_int", referenced from:
"_sqlite3_free", referenced from:
"_sqlite3_bind_int64", referenced from:
"_sqlite3_open", referenced from:
"_sqlite3_last_insert_rowid", referenced from:
"_sqlite3_column_bytes", referenced from:
"_sqlite3_bind_parameter_index", referenced from:
"_sqlite3_bind_blob", referenced from:
"_sqlite3_column_text", referenced from:
"_sqlite3_finalize", referenced from:
"_sqlite3_errmsg", referenced from:
"_sqlite3_busy_handler", referenced from:
"_sqlite3_reset", referenced from:
"_sqlite3_changes", referenced from:
"_sqlite3_open_v2", referenced from:
"_sqlite3_column_int64", referenced from:
"_sqlite3_next_stmt", referenced from:
"_sqlite3_bind_text", referenced from:
"_sqlite3_libversion", referenced from:
"_sqlite3_bind_parameter_count", referenced from:
"_sqlite3_bind_double", referenced from:
"_sqlite3_sleep", referenced from:
"_sqlite3_close", referenced from:
clang: error: linker command failed with exit code 1 (use -v to see invocation)
转到您的项目 - >一般 - >链接的框架和库您可以添加此libsqlite3.0.tbd。现在可以构建您的项目和框架。