gpt4 book ai didi

使用FFMPEG库时编译错误

转载 作者:行者123 更新时间:2023-11-30 21:37:46 24 4
gpt4 key购买 nike

我尝试使用 FFMPEG 编译 C 程序,但每次编译都会在包含语句处失败:

#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>

Gcc 提供此错误消息:

libavcodec/avcodec.h: No such file or directory

我已经安装了 FFMPEG 并创建了共享库,但是当我在编译时尝试链接这些库时,出现了相同的错误。

gcc main.c -L ffmpeg_build/lib -l ffmpeg_build/include/libavcodec/avcodec.h 

我收到此错误是因为我错误地链接了库,还是存在其他问题?

这是我第一次使用别人的库,所以如果我问了一个愚蠢的问题,请原谅。

最佳答案

小写的-l是一个链接器选项,用于指定。它们可能看起来像libsomething.a,并在链接器调用中变成-lsomething。为了将目录添加到 header 搜索路径,请使用大写 i,-I

gcc main.c -L/some/path/ffmpeg_build/lib -I/some/path/ffmpeg_build/include

关于使用FFMPEG库时编译错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26829746/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com