[FFmpeg-trac] #9100(undetermined:new): Can't link FFMPEG dynamically to VS 2019 project
FFmpeg
trac at avcodec.org
Thu Feb 11 11:51:39 EET 2021
#9100: Can't link FFMPEG dynamically to VS 2019 project
-------------------------------------+-------------------------------------
Reporter: ms2010 | Type: defect
Status: new | Priority: normal
Component: | Version:
undetermined | unspecified
Keywords: | Blocked By:
Blocking: | Reproduced by developer: 0
Analyzed by developer: 0 |
-------------------------------------+-------------------------------------
I downloaded the source code of FFMPEG 3.4.8 and built with MSVC as such:
After unzipping, open x86_x64 Cross Tools Command Prompt for VS 2019 and
run msys2_shell.cmd. From there, run
{{{
./configure --toolchain=msvc --arch=x86_64 --enable-yasm --enable-asm
--enable-shared --disable-static
}}}
and
{{{
make
}}}
I then created a new project in VS 2019.
In Properties > C/C++ > General > Additional Include Directories:
(Where all the headers are)
{{{
E:\ffmpeg-3.4.8\libavutil
E:\ffmpeg-3.4.8\libavcodec
E:\ffmpeg-3.4.8\libavdevice
E:\ffmpeg-3.4.8\libavfilter
E:\ffmpeg-3.4.8\libavresample
E:\ffmpeg-3.4.8\libpostproc
E:\ffmpeg-3.4.8\libswscale
E:\ffmpeg-3.4.8\libswresample
E:\ffmpeg-3.4.8\libavformat
}}}
In Properties > Linker > General > Additional Library Directories:
(Where the .lib files are)
{{{
E:\ffmpeg-3.4.8\libavutil
E:\ffmpeg-3.4.8\libavcodec
E:\ffmpeg-3.4.8\libavdevice
E:\ffmpeg-3.4.8\libavfilter
E:\ffmpeg-3.4.8\libavresample
E:\ffmpeg-3.4.8\libpostproc
E:\ffmpeg-3.4.8\libswscale
E:\ffmpeg-3.4.8\libswresample
E:\ffmpeg-3.4.8\libavformat
}}}
In Properties > Linker > Input > Additional Dependencies:
{{{
avcodec.lib
avdevice.lib
avfilter.lib
avformat.lib
swresample.lib
swscale.lib
}}}
For good measure, I copied the .dll files of each library to the Release
folder of the project. There is one source file I am trying to build and
run:
{{{
extern "C" {
#include <libavformat/avformat.h>
}
int main() {
AVFormatContext* pFormatContext = avformat_alloc_context();
}
}}}
The result of 'Build' is as follows:
{{{
1>------ Build started: Project: FFMPEG_example, Configuration: Release
x64 ------
1>Source.cpp
1>Source.obj : error LNK2001: unresolved external symbol
avformat_alloc_context
1>C:\Users\maya.s\source\repos\FFMPEG_example\x64\Release\FFMPEG_example.exe
: fatal error LNK1120: 1 unresolved externals
1>Done building project "FFMPEG_example.vcxproj" -- FAILED.
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped
==========
}}}
Did I do something wrong?
--
Ticket URL: <https://trac.ffmpeg.org/ticket/9100>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker
More information about the FFmpeg-trac
mailing list