Question

I have cross-compiled FFMPEG from Debian using the mingw32 toolchain. The result of the compilation is a set of .a files. When I try to use them in my project I get linker errors, concretely the following ones:

1>RTSPCapture.obj : error LNK2019: unresolved external symbol _avformat_free_context referenced in function ...
1>RTSPCapture.obj : error LNK2019: unresolved external symbol _avio_close referenced in function ...
1>RTSPCapture.obj : error LNK2019: unresolved external symbol _avcodec_close referenced in function ...
(and much more...)

I have already included the header files like this:

extern "C"
{
    #include <libavcodec/avcodec.h>
    #include <libavformat/avformat.h>
    #include <libavformat/avio.h>
}

And I use the .a files like this:

#pragma comment(lib, "libavcodec.a")
#pragma comment(lib, "libavformat.a")
#pragma comment(lib, "libavutil.a")

May I know why I am still getting linker errors? Best regards,

EDIT: I have realized that this is not possible. So, what should I do to use FFMPEG library in my MSVC2010 project taking into account that I can't compile ffmpeg in Windows? it seems to be REALLY difficult...

Was it helpful?

Solution 2

Finally I realized that mingw compiles libs could not be linked in VS2010 native applications.

OTHER TIPS

GCC (the compiler used by MinGW) does not have the #pragma used by VisualC++ to add libraries. You have to manually add the libraries when linking using the -l option:

$ gcc objectfile1.o objectfile2.o -o executable -lavcodec -lavformat -lavutil
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top