ffmpegmxe

Cross compiling FFmpeg + Qt application with MXE


I got a pretty simple project that uses Qt as well as FFmpeg that i developed under linux.
Now I'am having trouble cross compiling said project with MXE to use it on a windows machine.

Under linux everything i had to do was adding

LIBS += -lavcodec -lavformat -lswscale -lavutil

to Qt's .pro file and wrap the includes for FFmpeg in an "extern "C"" block and it compiles just fine.

Now for MXE i just cloned the git repo and used

make MXE_TARGETS='x86_64-w64-mingw32.static' qt5 ffmpeg

As the MXE doc states i set the PATH variable and used

qmake && make

But i get a lot of undefined reference errors regarding libavformat.

Can anybody tell me what i am doing wrong here? I'm kinda lost.


Solution

  • Okay so I got this working.

    The mxe version of gcc requires you to include the library multiple times if it is referenced by a library after it in the list of libraries to link.

    Add -lavformat to the end of the LIBS line.