linux - 如何在 eclipse linux 中正确链接 ffmpeg 项目

标签 linux eclipse ffmpeg

我在使用 ffmpeg 的 linux eclipse 上有一个小测试项目。 可以用命令行来实现

g++ -o m_vector -I/usr/include -I/usr/local/include m_vector.cpp -lavformat -lavcodec -lavutil -lm -lz -lva -lpthread

但是在 eclipse 中链接时我得到了一大堆错误

/home/user/projects/ffmpeg/libavcodec/internal.h:194: undefined reference to `av_rescale_q'
/usr/local/lib/libavcodec.a(mpegvideo.o): In function `update_picture_tables':
/home/user/projects/ffmpeg/libavcodec/mpegvideo.c:663: undefined reference to `av_buffer_unref'
/home/user/projects/ffmpeg/libavcodec/mpegvideo.c:663: undefined reference to `av_buffer_ref'
/home/user/projects/ffmpeg/libavcodec/mpegvideo.c:664: undefined reference to `av_buffer_unref'
/home/user/projects/ffmpeg/libavcodec/mpegvideo.c:664: undefined reference to `av_buffer_ref'
/home/user/projects/ffmpeg/libavcodec/mpegvideo.c:665: undefined reference to `av_buffer_unref'
/home/user/projects/ffmpeg/libavcodec/mpegvideo.c:665: undefined reference to `av_buffer_ref'

等等

我已经在项目中添加了所需的库,并且我使用了“extern c”。我的项目也知道需要包含。挖互联网没有给出答案。

最佳答案

交换您链接到的库的顺序,一个依赖于另一个。依赖最多的必须是最后一个,在本例中是 libavutil。

关于linux - 如何在 eclipse linux 中正确链接 ffmpeg 项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21019380/

相关文章:

java - 在Eclipse上创建两个Android项目

batch-file - 批量读取输出

audio - Libav 和 xaudio2 - 音频不播放

linux - 如何使用 --disable-multilib 构建 gcc 交叉编译器

java - 如何配置 Eclipse 以显示断言错误?

php - GIT - Web 开发工作流程/部署

eclipse - 为什么在氧 eclipse 的团队和比较菜单中不显示注释并与另一个修订版进行比较

linux - 启动多个 FFmpeg session

linux - Qt Creator 为 Raspberry Pi 2 进行交叉编译和远程部署的正确设置 - 为错误的架构生成二进制文件

linux - 在 Linux 下,被忽略的信号是否仍会中断系统调用?