Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

No member named 'clock' in the global namespace when using FFmpeg pod

My app (iOS 7+, Xcode 6) uses CocoaPods for its dependencies. One of the dependencies is FFmpeg.

When I build my app I get several similar looking issues 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 'flock'?

I learned that this is because FFmpeg includes time.h file in libavutil subfolder. This time.h hides system time.h from the compiler and thus the errors.

I tried to manually rename FFmpeg's time.h to something else and this helps. Now I want to do that automatically and in a way that will survive next 'pod update'.

I tried to add libavutil to Sub-Directories to Exclude In Recursive Searches but this doesn't help at all.

I tried to remove "${PODS_ROOT}/Headers/Public/FFmpeg/libavutil" from Header Search Paths and it didn't help either.

I know there are prepare_command and post_install hooks one can use in his Podfile but unfortunately I don't know if these are helpful in my case.

So, how can I exclude time.h in libavutil of FFmpeg pod from header search paths (I don't mind to rename or even remove the time.h)?

like image 361
Bobrovsky Avatar asked Jul 07 '15 13:07

Bobrovsky


1 Answers

For people who have the same issue with ffmpeg's time.h:

You might search the system's time.h and include it manually in the ffmpeg's time.h:

open ffmpeg's time.h (in libavutil) and insert #include </usr/include/time.h> in the beginning.

Of course this is just a lazy workaround, but it's an easy way to include both time.h headers.

like image 124
Snow bunting Avatar answered Nov 15 '22 00:11

Snow bunting