【问题标题】:Swift Preprocessing Error: Expected end of line in preprocessor expressionSwift 预处理错误:预处理器表达式中的预期行尾
【发布时间】:2020-04-23 19:50:22
【问题描述】:

好的,我正在解决关于duplicate symbols in cocoa pods' architecture 的问题。在接受的解决方案中使用post_install 安装 pod 后,我构建了我的 xcworkspace 项目,但遇到以下错误:

Screenshot of location of file and error.

错误是:预处理器表达式中的预期行尾。
上线:#if HAVE_FULLFSYNC
方法中:SyncFd(int fd, const std::string& fd_path)
并且文件的位置是:Pods/Pods/leveldb-library/env_posix.cc

我添加的引发这一系列问题的 Pod 是来自 here 的“CodableFirebase”。

这是我的 Podfile:

platform :ios, '13.2'

post_install do |installer_representation|
    installer_representation.pods_project.targets.each do |target|
        target.build_configurations.each do |config|
            config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = '$(inherited), PodsDummy_Pods=SomeOtherNamePodsDummy_Pods'
        end
    end
end


target 'ShoeSwiperMenus' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for ShoeSwiperMenus
# add the Firebase pod for Google Analytics
pod 'Firebase/Analytics'
# add pods for any other desired Firebase products
# https://firebase.google.com/docs/ios/setup#available-pods
pod 'Firebase/Core'
pod 'Firebase/Firestore'
pod ‘FirebaseUI/Auth'
pod 'FirebaseUI/Google'
pod 'FirebaseUI'
pod 'MaterialComponents/Buttons'
pod 'MaterialComponents/Buttons+Theming'
# pod 'MaterialComponents/schemes/Color'

pod 'Shuffle-iOS'
pod 'JGProgressHUD'
pod 'LBTATools'
pod 'CodableFirebase'

end

删除post_install 块时,我回溯到我原来的错误是:
ld:架构 x86_64 的 202 个重复符号。
clang:错误:链接器命令失败,退出代码为 1(使用 -v 查看调用)

我在这里真的超出了我的深度......我什至不知道如何开始解决这个问题(Google 上没有)。请帮忙!

【问题讨论】:

标签: swift firebase cocoapods leveldb


【解决方案1】:

我刚刚将您的 Podfile 添加到一个空项目中,得到了相同的错误,然后删除了 post_install 块并且能够构建而没有错误。

所以,删除 post_install 块。无论它应该解决什么问题,它都会创造这个问题。

另外,我建议将inhibit_all_warnings! 添加到 Podfile。

【讨论】:

  • 感谢您的回答和cmets Gereon!不幸的是,我需要post_install 块。其目的是删除架构中的重复符号(如 here 所述)。它可以防止我在安装 CodableFirebase pod 时遇到的另一个错误
  • 啊,inhibit_all_warnings!,帮了大忙!
  • 所以我尝试从post_install 块中保留leveldb-library,但这没有帮助
  • 就像我说的,我的项目没有错误。当编译步骤失败时,您没有看到任何链接器错误也就不足为奇了。
  • 我在删除 post_install 块时确实看到了链接器错误...我在问题的底部添加了它。我真的很困惑如何在没有任何错误的情况下构建它。还有什么可以让它在我这边崩溃的吗?
猜你喜欢
  • 2013-12-28
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-02-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多