4

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)
Shegit Brahm
  • 725
  • 2
  • 9
  • 22
Amrita
  • 65
  • 1
  • 3
  • 9

4 Answers4

10

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.

Dhruv
  • 2,153
  • 3
  • 21
  • 45
1

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

ItalyPaleAle
  • 7,185
  • 6
  • 42
  • 69
  • Dynamic libraries are a good thing, especially on limited resource embedded platforms. iOS even mmaps all the dylib files for efficiency. People should not be compiling source into their projects when dylibs are available (with exceptions for edge cases, which this guy doesn't seem to be in). If he/she copies the source into their project, then they don't get sqlite improvements in future iOS releases, unless they keep manually downloading new code. *Most* projects would not want this. In this case, the person has obviously just messed up the framework linkage. They should fix that. – Nate Jun 19 '12 at 20:57
  • Thanks! This line was helpful: "When compiling for the iOS simulator, the architecture is i386" – ArturOlszak Nov 25 '13 at 13:52
0

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

#include <sqlite3.h>
Senthilkumar
  • 2,471
  • 4
  • 30
  • 50
0

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.

tjdaniel2
  • 181
  • 1
  • 4