我正在使用libsqlite3.dylib,并在编译项目时收到以下错误。
ld: warning: ignoring file /Users/dcdmc/Documents/Beginning iPhone 5 Dev/Persistence copy/libsqlite3.dylib,
missing required architecture i386 in file
Undefined symbols for architecture i386:
"_sqlite3_open", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
-[OJViewController applicationWillResignActive:] in OJViewController.o
"_sqlite3_close", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
-[OJViewController applicationWillResignActive:] in OJViewController.o
"_sqlite3_exec", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
"_sqlite3_prepare_v2", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
-[OJViewController applicationWillResignActive:] in OJViewController.o
"_sqlite3_step", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
-[OJViewController applicationWillResignActive:] in OJViewController.o
"_sqlite3_column_int", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
"_sqlite3_column_text", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
"_sqlite3_finalize", referenced from:
-[OJViewController viewDidLoad] in OJViewController.o
-[OJViewController applicationWillResignActive:] in OJViewController.o
"_sqlite3_bind_int", referenced from:
-[OJViewController applicationWillResignActive:] in OJViewController.o
"_sqlite3_bind_text", referenced from:
-[OJViewController applicationWillResignActive:] in OJViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
答案 0 :(得分:10)
首先进行备份并检查是否将此框架物理复制到其根目录中的项目文件夹中,如果在那里找到它,只需从那里删除它然后重新构建。希望它有所帮助。
答案 1 :(得分:1)
您的目标是模拟器吗?
问题是:
您的项目包含一个不包含i386代码的动态库。
由于库是SQLite,我的建议不是将它包含在动态库中;相反,直接在项目中包含源代码(它只是2个文件:sqlite.c和sqlite.h)。 您可以从以下网址下载sqlite的源代码:http://www.sqlite.org
答案 2 :(得分:0)
在类
中使用sqlite操作前包含这个#include <sqlite3.h>
答案 3 :(得分:0)
我是iOS开发的新手,但我正在阅读Apress的书“开始iOS 6开发”,并在第13章遇到了一个非常类似的问题。我不得不使用Text mate打开project.pbxproj文件中的( YourProjectName).xcodeproj文件并删除“LIBRARY_SEARCH_PATHS”。有两个不同的行,一个是调试版本设置,另一个是发布版本设置。我希望这对某些人有帮助。