I am trying to use libavcodec from ffmpeg library in C++ with Visual Studio 2017 Community. I downloaded the latest x64 dev and shared builds from zeranoe (version 20171217), set up include directories and additional libraries in Visual Studio for x64 build, added DLL files from shared package to my PATH.
This is my sample test code:
extern "C" {
#include <libavcodec\avcodec.h>
}
int main() {
avcodec_register_all();
AVFrame *pAvFrame = av_frame_alloc();
av_frame_free(&pAvFrame);
return 0;
}
The code compiles without problems but when I run the application I see a dialogue window with error message "the procedure entry point for av_frame_alloc could not be located in DLL" (actual message is not in English, this is the translated version).
I tried to set Linker->Optimization->References to /OPT:NOREF as it was advised in the similar questions but it did not help.
Dependency walker shows that av_frame_alloc is exported, "Entry Point" is not bound. A little bit strange is that av_frame_alloc is displayed in both avcodec-58.dll (as red) and avutil-56.dll (as green). Maybe the reason is that the application is trying to get this function from avcodec instead of avutil, but I'm not sure, since I did not check the source code of these libraries.
So the question is how to set up such a simple FFMPEG-based C++ project in VS2017, where I'm wrong?
UPD. 1.
Linker flags: /OUT:"C:\work\code\TestFfmpeg\x64\Release\TestFfmpeg.exe" /MANIFEST /NXCOMPAT /PDB:"C:\work\code\TestFfmpeg\x64\Release\TestFfmpeg.pdb" /DYNAMICBASE "c:\work\dev\ffmpeg-20171217-387ee1d-win64-dev\lib*.lib" "kernel32.lib" "user32.lib" "gdi32.lib" "winspool.lib" "comdlg32.lib" "advapi32.lib" "shell32.lib" "ole32.lib" "oleaut32.lib" "uuid.lib" "odbc32.lib" "odbccp32.lib" /DEBUG:FULL /MACHINE:X64 /OPT:NOREF /PGD:"C:\work\code\TestFfmpeg\x64\Release\TestFfmpeg.pgd" /MANIFESTUAC:"level='asInvoker' uiAccess='false'" /ManifestFile:"x64\Release\TestFfmpeg.exe.intermediate.manifest" /OPT:ICF /ERRORREPORT:PROMPT /NOLOGO /TLBID:1
Try to download the 32-bit version of the .exe file (program). This solved the isse for me for Postman.exe