Avcodec_register_all Error
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and ffmpeg undefined reference to av_register_all policies of this site About Us Learn more about Stack Overflow the undefined reference to avcodec_register_all company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up FFMPEG: undefined reference to `avcodec_register_all' does not link up vote 1 down vote favorite So I have a very sample code for trying to decode a FFMPEG video stream. My problem is avcodec does not want to link, to do so I made a clean installation of Ubuntu 13.04. I have build ffmpeg from source following the guide here: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu I just want to compile my file. Note that my ubuntu does not have any implementations or header files for avcodec. The command line I use is: gcc -I/home/USER/ffmpeg_build/include -L/home/USER/ffmpeg_build/lib -lavcodec -o test.exe Downloads/auv/src/dronerosvideo/src/ar2.cpp /tmp/ccKTprFq.o: In function `fetch_and_decode(int, int, bool)': ar2.cpp:(.text+0x36e): undefined reference to `avcodec_register_all' ar2.cpp:(.text+0x378): undefined reference to `av_log_set_level' ar2.cpp:(.text+0x382): undefined reference to `avcodec_find_decoder' ar2.cpp:(.text+0x3b1): undefined reference to `avcodec_alloc_context3' ar2.cpp:(.text+0x3d6): undefined reference to `avcodec_open2' ar2.cpp:(.text+0x46d): undefined reference to `av_init_packet' ar2.cpp:(.text+0x50a): undefined reference to `avcodec_decode_video2' ar2.cpp:(.text+0x534): undefined reference to `av_free_packet' /tmp/ccKTprFq.o:(.eh_frame+0x13): undefined reference to `__gxx_personality_v0' collect2: error: ld returned 1 exit status Just for a sane test if I remove the -L argument compiler says: /usr/bin/ld: cannot find -lavcodec Which means that the linker finds the library in /home/USER/ffmpeg_build/lib. Also if we check the library for implementation it exists: nm ffmpeg_build/lib/libavcodec.a | grep "register_all" 0000000000000000 T avcodec_register_all Also as advised since it is C++ I have exten "C" around the include of the library. At this point I'm falling out of any ideas at all, why exactly compilation fails? c++ ubuntu gcc ffmpeg linker-error share|improve this quest
to check the nightly builds in the forum. Home Help Search Login Register Wiki Code::Blocks » User forums » Using Code::Blocks » Compiling the FFMPEG library « previous next » Send this topic Print Pages: [1] Go Down Author Topic: Compiling the FFMPEG library (Read 5507 times) DavidNorgren Single posting newcomer Posts: 2 Compiling the http://stackoverflow.com/questions/24487203/ffmpeg-undefined-reference-to-avcodec-register-all-does-not-link FFMPEG library « on: July 15, 2014, 01:23:47 am » Hello, I'm trying to compile some simple code using the FFMPEG library:Code: [Select]extern "C" { // also tried without this
#include
}
int main()
{
AVCodec* codec;
avcodec_register_all();
http://forums.codeblocks.org/index.php?topic=19455.0 return 0;
}The header file contains the AVCodec struct and void avcodec_register_all(void); but I still get undefined reference to `avcodec_register_all'. It doesn't complain about the AVCodec pointer.My project build options:Linker Settings->Link Libraries: C:\Libs\ffmpeg\lib\avcodec.libSearch Directories->Compiler: C:\Libs\ffmpeg\includeSearch Directories->Linker: C:\Libs\ffmpeg\libAny ideas why I get this error? I've searched the internet for several hours but without luck. Logged stahta01 Lives here! Posts: 5379 Re: Compiling the FFMPEG library « Reply #1 on: July 15, 2014, 01:29:53 am » http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F Logged C Programmer working to learn more about C++ and Git.On Windows 7 64 bit and Windows 10 32 bit.On Debian Testing, compiling CB Trunk against wxWidgets 3.0.2.--When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org DavidNorgren Single posting newcomer Posts: 2 Re: Compiling the FFMPEG library « Reply #2 on: July 15, 2014, 01:43:09 am » Quote from: stahta01 on July 15, 2014, 01:29:53 amhttp://wiki.codeblocks.org/index.p
from GoogleSign inHidden fieldsSearch for groups or messages