7

Every time when I open my app with Xcode I get this error:

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

Then I need to unmark the target on the libGoogleAnalyticsServices.a file and mark it on again. After the uncheck/check of the target the app runs normally...

enter image description here

I get 2 other warning when this happens:

ld: warning: directory not found for option '-L/Users/vision/Documents/Apps/Mijn Cijfers/Mijn'
ld: warning: directory not found for option '-LCijfers'

Now this looks like Xcode can't read spaces and looks for a new directory called Cijfers. My app is called: Mijn Cijfers, but I never had this problem before with spaces in my project name.

Every time when I check/uncheck the target of libGoogleAnalyticsServices.a the Library Search Path is adding new rows:

enter image description here

I think both cases has to do something with the warnings and errors that I get. It's really annoying to remove the Library Search Paths and check/uncheck the target to let my app run normally. -.-

Does anyone know a solution to solve this odd bug?

SDW
  • 1,880
  • 4
  • 19
  • 30

2 Answers2

14

You need to delete all these path except the "$inherited" and then add Google Analytics library path (Drag the folder where you saved the library).

If you follow this then you don't need to recheck/uncheck the library path.

library search Path screen shot

Meenakshi
  • 1,162
  • 9
  • 13
  • Thanks a lot! I made a new folder called: "Library" with Finder in the Project root folder (with the Google Analytics SDK files) and than drag the folder to the Library Search Path window. If I close Xcode now and re-open I can finally build my app! :D – SDW Oct 19 '15 at 19:38
  • i am getting same error (linker command failed with exit code 1 (use -v to see invocation)) but it is saying library not found for -libc++, how to resolve this – madhuiOS Dec 01 '16 at 04:44
11

If you have just created pod file by running $ pod init command in terminal,

  • then just close project and Open projectName.xcworkspace instead of projectName.xcodeproj

which will not throw error -lxyzLibray eg. -lJSONModel not found.

Now compile and debug again It will work.

karan
  • 3,319
  • 1
  • 35
  • 44
  • This works. But when I compile and upload it to itunes connect, do I use `projectName.xcodeproj` or `projectName.xcworkspace` from Xcode? – Neel May 19 '18 at 10:38