I’ve developed my own framework for iPhone. Among my classes, I have classes to manage SQLite databases. So I need to link my framework with the libsqlite3.dylib. Compilation/Creation of the framework is working, but when I link my custom framework in an application and compile it, I get errors like :
Undefined symbols for architecture i386:
“_sqlite3_open”, referenced
from:
-[CSQLite open:ext:copyDataBase:] in CUtils(CSQLite.o) “_sqlite3_create_function”, referenced from:
-[CSQLite open:ext:copyDataBase:] in CUtils(CSQLite.o) “_sqlite3_value_text”, referenced from:
_sql_regexp in CUtils(CSQLite.o) “_sqlite3_result_int”, referenced from:
_sql_regexp in CUtils(CSQLite.o) “_sqlite3_close”, referenced from:
-[CSQLite close] in CUtils(CSQLite.o) “_sqlite3_prepare”, referenced from:
-[CSQLite query:Rows:] in CUtils(CSQLite.o)
By linking the libsqlite3.dylib in my application, the errors disappeared.
Is there a way to link libsqlite3.dylib directly inside my own framework or do I need to always add libsqlite3.dylib in the application?
Your framework uses sqlite3 framework, when you send your framework to third party devs just document that they also have to link the project to sqlite3. There is no other way.
Best example is ASIHttp they don’t pack the code in to framework or a static library, but if you want to use it you have to link your project to the frameworks that they are using.