Question

I am using libsqlite3.dylib and am getting the following error when am compiling my project.

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)
Was it helpful?

Solution

First of all take backup and Check if you copied this framework physically to your project folder in its root directory,if you find it there,just delete it from there and re build afterwards.Hope it helps.

OTHER TIPS

Are you targeting the simulator?

Problem is:

  1. When compiling for the iOS simulator, the architecture is i386
  2. When compiling for the iOS device, arch is armv6/armv7

Your project is including a dynamic library that doesn't include i386 code.

Since the library is SQLite, my suggestion is not to include it as a dynamic library; instead, include the source code directly in your project (it's just 2 files: sqlite.c and sqlite.h). You can download sqlite's source code from: http://www.sqlite.org

include this you using the before the sqlite operation in a class

#include <sqlite3.h>

I am very new to iOS development but I am going though Apress's book "Beginning iOS 6 Development" and came across a very similar problem in Chapter 13. I had to use Text mate to open the project.pbxproj file in the (YourProjectName).xcodeproj file and delete "LIBRARY_SEARCH_PATHS". There are two different lines, one debug build settings and the other in the release build settings. I hope this is helpful to some one.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top