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

如何在eclipse linux中正确链接ffmpeg项目,linux,eclipse,ffmpeg,Linux,Eclipse,Ffmpeg,我在LinuxEclipse上有一个使用ffmpeg的小测试项目。 可以使用命令行进行设置 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:

我在LinuxEclipse上有一个使用ffmpeg的小测试项目。 可以使用命令行进行设置

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'
等等


我已经在项目中使用了所需的lib,并且使用了“externC”。我的项目也知道需要包括。挖掘互联网没有给出答案。

将在路径\u到\u gcc/usr/lib中搜索这些库。希望您没有这些库。将
-L$path添加到库

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

Ubuntu不同的Windows操作系统。
Ubuntu排序库,因此您可以像这样添加库:
-lavdevice-lavformat-lavcodec-lavutil-lswscale-lavfilter-lpthread-lz-lm-lswresample

添加完成后。如果出现错误:
未定义对vaCreateBuffer的引用…
,则应重新生成ffmpeg并禁用
-lva
lib。
示例:内置:
将行路径替换为:
PATH=“$HOME/bin:$PATH”PKG\u CONFIG\u PATH=“$HOME/ffmpeg\u build/lib/pkgconfig”

/configure\

--prefix=“$HOME/ffmpeg\u build”\

--pkg config flags=“--static”\

--extra cflags=“-I$HOME/ffmpeg\u build/include”\

--extra-ldflags=“-L$HOME/ffmpeg\u build/lib”\

--bindir=“$HOME/bin”\

——禁用vaapi

我不构建libx264、libx265、libfdk aac。。。。。我不需要信用证。如果需要,您可以构建。

行代码:
--disable vaapi
是disable
-lva
lib。

我还从git repo获取了新的ffmpeg,并使其手动安装ffmpeg文件在链接时具有未定义的引用。因此,我在ffmpeg lib所在的位置添加了-L\usr\local\lib,没有任何更改。考虑到将路径导出到变量,并将其与
-L
一起使用(看起来很有趣,请尝试一下)