No member named 'clock' in global namespace when using FFmpeg pod
My app (iOS 7+, Xcode 6) uses CocoaPods for its dependencies. One of the FFmpeg dependencies .
When I build my application I am getting several similar questions like
/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 "herd"?
I found out that this is because FFmpeg contains the time.h
file in a subfolder libavutil
. This one time.h
hides the system time.h
from the compiler and hence errors.
I tried manually renaming FFmpeg time.h to something else and it helps. Now I want to do this automatically and in a way that will survive the next pod update.
I tried adding libavutil to Sub-Directories to Exclude In Recursive Searches
, but that doesn't help at all.
I tried removing "$ {PODS_ROOT} / Headers / Public / FFmpeg / libavutil" from Header Search Paths
and that didn't help either.
I know there are hooks prepare_command
and post_install
that can be used in its subfile, but unfortunately I don't know if they are useful in my case.
So how can I exclude time.h in libavutil of the FFmpeg module from the header search paths (I don't mind renaming or even removing time.h)?
source to share
For people having the same problem with ffmpeg time.h
:
You can search the system time.h
and enable it manually in ffmpeg time.h
:
open ffmpeg time.h
(in libavutil
) and paste #include </usr/include/time.h>
at the beginning.
Of course this is just a lazy workaround, but it is an easy way to include both headers time.h
.
source to share