如何将Ubuntu11中的Eclipse Indigo链接到FFMPEG 8 for C++

How to link Eclipse Indigo in Ubuntu 11 to FFMPEG 8 for C++

本文关键字:FFMPEG for C++ 链接 Indigo Ubuntu11 中的 Eclipse      更新时间:2023-10-16

我已经尝试了书中的一切,以及我能找到的关于如何做到这一点的一切,并多次重新安装、重新配置和重建,但都无济于事。这就是我所拥有的。我在Ubuntu虚拟机上制作了FFMPEG,并编写了以下代码:

#include "libavcodec/avcodec.h"
#include "libavformat/avformat.h"
#include <stdio.h>
#include <iostream>
using namespace std;
int main( int argc, char* argv[] ) {
    avcodec_register_all();
    return 0;
}

这个错误并说:

/home/adam/workspace/MP4 Tools/Debug/../testDriver.cpp:19: undefined reference to     `avcodec_register_all()'
collect2: ld returned 1 exit status

我已经包含了libavcodec.a文件。项目->属性->GCC C++链接器->库->添加"avcodec"

有人能想到我没有做或忽略的事情吗?非常感谢。

我在这里发布了一个解决方案

但不要忘记,如果您使用c++,您应该以这种方式包含ffmpeg标头:

extern "C"{
#include<libavformat/avformat.h>
#include<libavcodec/avcodec.h>
}