Search code examples
dlllinkerffmpegcygwinshared-libraries

Linking with ffmpeg shared build


I am trying to work with the ffmpeg library on a cygwin development environment. I downloaded the shared build from here (64-bit). The bin folders contain dlls but no .a or .dll.a files. Linking, which is done like so:

$ gcc encoding_mp3.o -L/cygdrive/c/Users/Desktop/webserver/cygnus/lib/w32api -L/cygdrive/c/Users/Desktop/webserver/cygnus/ffmpeg/ffmpeg_shared/bin -lavcodec-54 -lm -luser32 -lpthread -o encoding_mp3

results in the following error:

/cygdrive/c/Users/Desktop/webserver/cygnus/ffmpeg/ffmpeg_shared/bin/avcodec-54.dll: file not recognized: File format not recognized collect2: ld returned 1 exit status

My question(s):
1. The bin/ folder in the shared build contains only avcodec-54.dll. Is there a way to convert the dll to a dll.a or .a?
2. Where am I going wrong?

If source code is required, please let me know.


Solution

  • You need to download the "dev" versions, or the "static linking" ones (a little down, on the page). dlls cannot be converted to libs, nor can they be used (usually) to generate they own little import stubs (the .dll.a)

    From the page you linked "Dev packages provide the headers and .lib/.dll.a files required to use the .dll files in other programs." .a / .lib usually are located in "lib" folders.