I downloaded the most recent Zeranoe dev build here, included the header files to my code, placed extern "C"
around the includes, since this is a C++ project and FFmpeg is a C library, and added the libs to Visual Studio as well, and I get this linker error:
1>Camera.obj : error LNK2019: unresolved external symbol _av_free referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_freep referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_alloc referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_frame_free referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_register_all referenced in function __catch$??0Camera@MicroDFV_Camera@@QAE@V?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@0PAX@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_alloc_context3 referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_open2 referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_close referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_init_packet referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_packet_unref referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_find_encoder referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _avcodec_encode_video2 referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_opt_set referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>Camera.obj : error LNK2019: unresolved external symbol _av_image_alloc referenced in function __catch$?NewFrameReceived@Camera@MicroDFV_Camera@@AAEXKKKGPAE@Z$0 1>M:\Desktop\OpenCVTest\Debug\OpenCVTest.exe : fatal error LNK1120: 14 unresolved externals
Searching here and on Google I found many recommendations, such as to add #pragma comment(lib,...)
, and that the libs are static, so their order is important, and none of this helps.
So I scratched my head even more and realized that the Zeranoe build is made with MinGW-w64, so probably it won't link with Visual Studio. I inspected the lib using dumpbin
and the symbols on the libs don't have the underscore, so I am pretty sure it won't work.
The other Zeranoe builds for Windows don't have libs, they are just plain .exe or exe + .dll.
Will I have to make my own VS2013 build of FFmpeg to link it, or is there some alternative way?