2

error " ld: library not found for -lmysqlclient " clang: error: linker command failed with exit code 1 (use -v to see invocation)

I add a c++ file in my project. The file include some librarys ,here is the list:

"Sqlite3.h"
<sqlite3.h>
<iostream>
<sstream>
<set>
<utility>
<stdio.h>
<stdlib.h>
<string.h>
<map>
<list>
<math.h>
<algorithm>

what's the problem ? should I have to change some setting in Xcode?

sam chi wen
  • 701
  • 6
  • 11

2 Answers2

0

First of all for your error :

please check the Library Search Paths. There are instances when you copy or duplicate a target, Xcode decides that it needs to escape any double quotes " with a '\'. Make sure you remove all the \’s - it should look like this -

enter image description here

Or another suggetion is , Please use cocoapods. It is good for dependency.

Here is full tutorial .

Install cocoapods

Because without using cocoapods you need to do more configuration like you need to set headerpath and etc it's a very tedious work.

After installing cocoapod in your project you need to open it from .xcworkspace not from .xcodeproj file. check edited image.

enter image description here

Community
  • 1
  • 1
Badal Shah
  • 7,541
  • 2
  • 30
  • 65
  • I think the Library Search Paths is OK. the c++ file is working in Android project and than i got a copy .it's user for reading some data by c++,using sqlite3. i think it maybe work in iOS project too. so just try it. – sam chi wen Feb 17 '16 at 10:34
  • I think it is tedious process. Still if you want to try then check this link. http://stackoverflow.com/questions/23438393/new-to-xcode-cant-open-files-in-c – Badal Shah Feb 17 '16 at 10:40
0

Try to add Other Linker Flags: -lmysqlclient -lm -lz). and refer this link :

library-not-found-for-lmysqlclient-after-mavericks-upgrade

Community
  • 1
  • 1
Bhoomi Jagani
  • 2,413
  • 18
  • 24
  • add it separate three times? " -lmysqlclient ; -lm ; -lz) "or add it all ? " -lmysqlclient -lm -lz) ".but both are still that error. T T – sam chi wen Feb 17 '16 at 10:40