Hello, I'm trying to compile some simple code using the FFMPEG library:
extern "C" { // also tried without this
#include <libavcodec/avcodec.h>
}
int main()
{
AVCodec* codec;
avcodec_register_all();
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.lib
Search Directories->Compiler: C:\Libs\ffmpeg\include
Search Directories->Linker: C:\Libs\ffmpeg\lib
Any ideas why I get this error? I've searched the internet for several hours but without luck.
http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F (http://wiki.codeblocks.org/index.php?title=FAQ-Compiling_%28errors%29#Q:_How_do_I_troubleshoot_a_compiler_problem.3F)
The build log says:
-------------- Clean: Debug in ffmpeg (compiler: GNU GCC Compiler)---------------
Cleaned "ffmpeg - Debug"
-------------- Build: Debug in ffmpeg (compiler: GNU GCC Compiler)---------------
mingw32-g++.exe -Wall -fexceptions -g -std=c++11 -IC:\Libs\ffmpeg\include -IC:\Libs\ffmpeg\include\libavcodec -c C:\Users\David\Downloads\ffmpeg\main.cpp -o obj\Debug\main.o
C:\Users\David\Downloads\ffmpeg\main.cpp: In function 'int main()':
C:\Users\David\Downloads\ffmpeg\main.cpp:9:14: warning: unused variable 'codec' [-Wunused-variable]
mingw32-g++.exe -LC:\Libs\ffmpeg\lib -o bin\Debug\ffmpeg.exe obj\Debug\main.o C:\Libs\ffmpeg\lib\avcodec.lib
obj\Debug\main.o: In function `main':
C:/Users/David/Downloads/ffmpeg/main.cpp:10: undefined reference to `avcodec_register_all'
collect2.exe: error: ld returned 1 exit status
Process terminated with status 1 (0 minute(s), 0 second(s))
1 error(s), 1 warning(s) (0 minute(s), 0 second(s))
I'm unsure how that's helpful.