Search code examples
ffmpegcygwinlibx264

FFMPEG on cygwin failed to compile libx264 error: unknown type name ‘HMODULE’


I am trying to compile libx264 in ffmpeg under cygwin environment.

I have followed some directions from several sources from Koohiimaster's blog, FFMPEG compilation guide, SO post 1, SO post 2 but I always stuck at the same step which is the libx264 compilation (make) process.

As mentioned in the FFMPEG compilation guide these steps should be followed in order to make libx264 works

cd ~/ffmpeg_sources
wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2
tar xjvf last_x264.tar.bz2
cd x264-snapshot*
PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" bindir="$HOME/bin" --enable-static --disable-opencl
PATH="$HOME/bin:$PATH" make
make install

but when i enter this command PATH="$HOME/bin:$PATH" make the compiler always stop with the following errors:

In file included from input/avs.c:49:0:
./extras/avisynth_c.h:825:3: error: unknown type name ‘HMODULE’
HMODULE handle;
^

I was wondering whether this is libx264 source's bug, but after I tried several earlier source version, it produce the same error. Any thoughts to solve this problem?


Solution

  • Info

    The type HMODULE is declared in WinDef.h. So you're missing to include this header. I think normally WinDef.h is included by windows.h.

    Alternative 1: Without AVS

    If you do not need avs support you might just disable it and see if it works then:

    PATH="$HOME/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" bindir="$HOME/bin" --enable-static --disable-opencl --disable-avs
    

    Actually this is a good choice to just check out and see if it gets you more information on your problem.

    Alternative 2: Check windows.h

    Another thing is to check which windows.h file is used in your configuration.

    In the libx264 sources input/input.h includes windows.h.

    input.h itself is then included by avs.c. avs.c also includes extras/avisynth_c.h thereafter. So all in all when the line HMODULE handle appears for the compiler, windows.h should have already been included (where WinDef.h should be included).

    So either your windows.h file is somehow "wrong" or something really goes wrong during preprocessing.