【问题标题】:Xcode error: library not found for -lGoogleToolboxForMacXcode 错误:找不到 -lGoogleToolboxForMac 的库
【发布时间】:2026-02-15 03:50:02
【问题描述】:

我正在尝试在我的 iPhone 应用程序中安装 admobs(用 Objective-c 编写)。我已经使用 swift 项目多次实现了这一点,但目前我不断收到以下构建错误:

ld: warning: directory not found for option '-L/Users/charlieseligman/Library/Developer/Xcode/DerivedData/ThamesClippers-csissodainpbbjenykdyxuutzxtg/Build/Products/Debug-iphonesimulator/GoogleToolboxForMac'
ld: warning: directory not found for option '-L/Users/charlieseligman/Documents/GIT/iOS.ThamesClippers/build/Debug-iphoneos/GoogleToolboxForMac'
ld: library not found for -lGoogleToolboxForMac
clang: error: linker command failed with exit code 1 (use -v to see invocation)

我肯定是在打开 .xcworkspace 文件(而不是 .xcodeproj 文件)。

我还尝试删除“DerivedData”文件夹内容和“清理”项目并执行“清理构建文件夹”。没有人解决这个问题。

我的 podfile 仅包含以下 pod:

# Pods for ThamesClippers
pod 'Google/Analytics'
pod 'Firebase/Core'
pod 'Firebase/AdMob'

# Trying to fix GoogleToolboxForMac missing error
pod 'Firebase/Messaging'
pod 'GoogleToolboxForMac/Logger' 
pod 'GoogleToolboxForMac', '~> 2.1'

我曾尝试一一添加底部的 3 个,但始终收到相同的构建错误。

有人可以帮忙吗?在这一点上完全失去了。看到这两个问题,但他们接受的解决方案并没有解决这个问题:

Framework not found GoogleToolboxForMac ld: library not found for -lGoogleToolboxForMac

【问题讨论】:

    标签: ios objective-c xcode admob google-toolbox-for-mac


    【解决方案1】:

    终于解决了:

    1. Xcode > 产品 > 方案 > 管理方案
    2. 选择“显示”失败的方案 (GoogleToolboxForMac)
    3. 在下拉菜单中选择此方案,就在“停止”按钮的右侧
    4. 构建此方案
    5. 然后选择原始方案(在步骤 3 中提到的下拉菜单中)并重建

    全部正确构建。

    所以看起来我必须手动构建单独的方案。

    注意:要自动构建这些,请使用 Product > Scheme > 'Edit Scheme' > Build > 并确保添加所有目标,并在底部添加您的项目目标。

    【讨论】:

    • 好吧,它解决了那个错误;然而,我又犯了一个错误-_-
    • @charlie-seligman:不明白你说的3是什么意思。可以发截图吗?
    【解决方案2】:

    在构建到 Simulator 时,我在 Xcode 10 中遇到了这个错误。这是因为我在尝试解决 Cocoapods 警告时删除了 xcodeproj 中的 Debug 基本配置: "CocoaPods did not set the base configuration of your project because your project already has a custom config set."

    我通过以下方式解决了问题:

    1. 添加Debug 基本配置
    2. Debug 配置值设置为None
    3. 正在运行pod install

    这是第 3 步后基本配置的样子: ]1

    【讨论】:

      最近更新 更多