FFMpeg示例程序 [英] FFMpeg sample program
问题描述
,我想使用代码块IDE编译ffmpeg示例程序,但不能
#include< stdio.h>
#include< stdlib.h>
#includelibavcodec / avcodec.h
#includelibavformat / avformat.h
int main(int argc,char * argv [])
{
av_register_all();
return 0;
}
请帮助我。如何编译我正在使用Linux(Ubuntu)
你必须告诉编译器头文件和库文件的位置。这是由 -I
标志来告诉哪些目录包含头文件, -L
来告诉哪些目录包含库。您还需要 -l </ code>来告诉哪些库可以链接。
标志可以这样使用:
$ g ++ -I / path / to / headers myprogram.cpp -L / path / to / libraries -lthelibrary
有关库的注意事项:在Linux(和UNIX系统)上,它们是名称以lib开头并以.a扩展名结尾的文件。所以。当使用 -l </ code>标志指定库时,请执行 写入。所以对于一个库文件libfoo.a,你只能使用
-lfoo
来链接。
有关gcc和g ++选项的更多信息,请参阅 http://gcc.gnu。 org / onlinedocs / gcc / Invoking-GCC.html 。
编辑:对于像Code :: Blocks这样的IDE,可能是一些项目设置,您可以添加包含和库目录和链接库。检查项目菜单中的设置或属性选项。
Edit2:参见例如此常见问题在Code ::块,预处理器设置应该靠近。
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:
$ g++ -I/path/to/headers myprogram.cpp -L/path/to/libraries -lthelibrary
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.
这篇关于FFMpeg示例程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!