I want to create a statically linked executable statically linked to libavcodec and libavformat. The ffmpeg static library was built with:
./configure --enable-static --enable-gpl --enable-nonfree --disable-vaapi --disable-libopus --prefix=myBuild --disable-swresample
Linkers are installed as follows:
g++ -O2 -static -o myBin myBin-myBin.o someotherlibraries.a -L/ffmpeg/myBuild/lib -lavformat -lavcodec -lavutil -lrt -lm -lpthread -lz
When compiling, I get the message ONLY ONE : - /
src/ffmpeg/myProgram.cpp:115: error: undefined reference to 'avcodec_alloc_context'
Output signal nm / ffmpeg / myBuild / lib / libavcodec.a | grep avcodec_alloc_context:
U avcodec_alloc_context3 U avcodec_alloc_context3 000003c0 T avcodec_alloc_context3 U avcodec_alloc_context3
I enable libavcodec.h with extern "C" {} and I believe my static linker order is correct. Why am I getting this error? Is it because this method is deprecated? How can i solve this?
DECISION:
Do not use
avCtx = avcodec_alloc_context()
from older code snippets but use
codec = avcodec_find_decoder(CODEC_ID_XYZ);
c ++ ffmpeg libavcodec libavformat static-linking
user2212461
source share