我的应用程序(iOS 7+、Xcode 6)使用 CocoaPods 作为其依赖项。其中一个依赖项是 FFmpeg .
当我构建我的应用程序时,我遇到了几个类似的问题,例如
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/ctime:60:9: No member named 'clock' in the global namespace; did you mean 'flock'?
我了解到这是因为 FFmpeg 在 libavutil
子文件夹中包含 time.h
文件。此 time.h
对编译器隐藏系统 time.h
,从而隐藏错误。
我尝试手动将 FFmpeg 的 time.h 重命名为其他名称,这有帮助。现在我想自动执行此操作,并以一种能够在下一次“pod 更新”中继续存在的方式。
我试图将 libavutil 添加到 Sub-Directories to Exclude In Recursive Searches
但这根本没有帮助。
我试图从 Header Search Paths
中删除“${PODS_ROOT}/Headers/Public/FFmpeg/libavutil”,但它也没有帮助。
我知道可以在他的 Podfile 中使用 prepare_command
和 post_install
Hook ,但不幸的是,我不知道这些对我的情况是否有帮助。
那么,如何从 header 搜索路径中排除 FFmpeg pod 的 libavutil 中的 time.h(我不介意重命名甚至删除 time.h)?
最佳答案
对于与 ffmpeg 的 time.h
有相同问题的人:
你可以搜索系统的time.h
并将其手动包含在 ffmpeg 的 time.h
中:
打开 ffmpeg 的 time.h
(在 libavutil
中)并插入 #include </usr/include/time.h>
一开始。
当然这只是一个懒惰的解决方法,但它是同时包含 time.h
的简单方法标题。
关于ios - 使用 FFmpeg pod 时全局命名空间中没有名为 'clock' 的成员,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31269793/