xcode library not found

后端 未结 12 785
南方客
南方客 2020-12-05 12:43

I\'m getting the following error:

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

相关标签:
12条回答
  • 2020-12-05 13:22

    If you have pods installed, make sure to open the workspace folder (white Xcode icon) not the project folder. This resolved the library not found for ... error. Very simple issue but I was stuck on this for a long time.

    0 讨论(0)
  • 2020-12-05 13:29

    The problem might be the following: SVN ignores .a files because of its global config, which means someone didn't commit the libGoogleAnalytics.a to SVN, because it didn't show up in SVN. So now you try to check out the project from SVN which now misses the libGoogleAnalytics.a (since it was ignored and was not committed). Of course the build fails.

    You might want to change the global ignore config from SVN to stop ignoring *.a files.

    Or just add the one missing libGoogleAnalytics.a file manually to your SVN working copy instead of changing SVNs global ignore config.

    Then re-add libGoogleAnalytics.a to your XCode project and commit it to SVN.

    0 讨论(0)
  • 2020-12-05 13:31

    In my case, the project uses CocoaPods. And some files are missing from my project.

    So I install it from CocoaPods: https://cocoapods.org/.

    And if the project uses CocoaPods we've to be aware to always open the .xcworkspace folder instead of the .xcodeproj folder in the Xcode.

    0 讨论(0)
  • 2020-12-05 13:32

    If you are using Pods to include the GoogleAnalytics iOS SDK into your project, it's worth noting that since the 3.0 release your Other Linker Flags needs to include -lGoogleAnalyticsServices not the old -lGoogleAnalytics

    0 讨论(0)
  • 2020-12-05 13:32

    In XCode 10.1, I had to set "Library Search Paths" to something like $(PROJECT_DIR)/.../path/to/your/library

    0 讨论(0)
  • 2020-12-05 13:37

    All in all, the Xcode cannot find the position of library/header/framework, then you tell Xcode where they are.

    set the path that Xcode use to find library/header/framework in Build Settings --> Library/Header/Framework Search Paths.

    Say, now it cannot find -lGoogleAnalytics, so you add the directory where -lGoogleAnalytics is to the Library Search Paths.

    0 讨论(0)
提交回复
热议问题