Windows: How to build X264.lib instead of .dll
c, encoding, h.264, video, x264
Solution
After the latest update of x264 you can build static library usable by MSVS project. For such library compilation you will need:
- MSYS and MSVS 2013 Update 2 (express version [for Windows Desktop] would also work if you install Update 2)
- run "VS2013 x86 Native Tools Command Prompt" or "VS2013 x64 Native Tools Command Prompt" depending what version (32 or 64-bit) you want to build
- change dir to x264 path and run MSYS shell (sh)
- from shell run "CC=cl ./configure --disable-cli --enable-static" for x264 configuring
- run "make" which should build libx264.lib usable from MSVS
P.S. MSVS builds would be a little bit slower than one build by MinGW
Problem
I downloaded the X264 source and installed mingw. Step 1: Executed this in the MINGW bash: ./configure --disable-cli --enable-shared --enable-win32thread - -extra-ldflags=-Wl,--output-def=libx264.def and then 'make' Step 2: Renamed the libx264-142.dll to libx264.dll and Opened up VS2012 Command Prompt and executed this: LIB /DEF:libx264.def which gave me libx264.lib and object libx264.exp Step 3: Included the lib file in a VS2012 project which uses the X264 API. Problem: When I start the project I get the following error message: "The program can't start because libx264.dll is missing from your computer" Question: Why is it looking for the dll when I'm linking the static library in? How do I resolve this? I would like to build a static X264 library which I can link in with my project. EDIT: I just had to put the dll in the same directory as the project executable. However - My question still stands: How do I build a static x264 library? So I don't need the dll?