I am currently learning ffmpeg tutorial of Martin Bohme Tutorial Here
and I want to compile an ffmpeg sample program using Code Block IDE but, it can't
#include <stdio.h>
#include <stdlib.h>
#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
int main(int argc, char *argv[])
{
av_register_all();
return 0;
}
Please help me. How to compile it. I am using Linux (Ubuntu)
You have to tell the compiler where the header and library files are. This is done by the
-I
flag to tell which directories contain header files, and-L
to tell which directories contains libraries. You will also need-l
to tell which libraries to link with.The flags can be used like this:
A note about libraries: On Linux (and UNIX systems) they are files with names that start with "lib" and end with the extension ".a" or ".so". When specifying the library with the
-l
flag you do not write those. So for a library file "libfoo.a", you only use-lfoo
to link with it.For more information about the options of gcc and g++, see http://gcc.gnu.org/onlinedocs/gcc/Invoking-GCC.html.
Edit: For an IDE like Code::Blocks there most likely is some project setting where you can add include and library directories and link libraries. Check the "Project" menu for a "Settings" or "Properties" alternative.
Edit2: See for example this FAQ where to find linker settings in Code::Blocks, the pre-processor settings should be close by.
For IDE like eclipse follow FFMPEG - Eclipse Setup Guide[Linux] official
you can try following command to compile in Linux.