c - 为什么找不到实际存在的头文件?

标签 c linux ffmpeg

我是C语言初学者,遇到一个问题,找不到头文件,但其实这些头文件都在当前文件中,我看到网上的方法(例如:solution)都是加-I选项可以解决这个问题,但是我很好奇,为什么找不到自己,只能靠-i选项?
包括路径:

ls .
include  test_ffmpeg.c
ls include/libavcodec/
avcodec.h  avfft.h    dirac.h       dxva2.h  vaapi.h  vdpau.h    videotoolbox.h   xvmc.h
avdct.h    d3d11va.h  dv_profile.h  qsv.h    vda.h    version.h  vorbis_parser.h
源码树:
root
 |-----test_ffmpeg.c 
 |-----include 
      
代码:
#include <stdio.h>

#include "./include/libavcode/avcodec.h"
#include "./include/libvformat/acfomat.h"
#include "./include/libavfilter/avfilter.h"

int main(void)
{

    return 0;
}
编译:
gcc test_ffmpeg.c  -lavcodec -lavdevice -lavfilter -lavformat -lavutil
发生 fatal error :
test_ffmpeg.c:3:10: fatal error: ./include/libavcode/avcodec.h: No such file or directory
#include "./include/libavcode/avcodec.h"
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

最佳答案

您的包含语句提到 include/libavcode ,但存在的路径是include/libavcodec .
添加 c你应该会看到不同。

关于c - 为什么找不到实际存在的头文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65298979/

相关文章:

c - ocaml 顶级和 native 库

linux - awk/bash 比较跨行的时间戳和排序时间差异

java - ubuntu中oracle jdeveloper的启动文件在哪里

php - 如何让drawtext过滤器在从右向左滚动时开始从中心滚动文本

android - ffmpeg解码后的帧存储在哪里?

audio - 如何使用 mkvmerge 和外部时间码强制 A/V 同步?

c - realloc 不为下一个结构分配内存

c - 在 C 中将字符串分配给 Hostent

c - 使用 C 确定系统是使用 Big Endian 还是 Little Endian

Python/Linux-如何创建一个脚本来监控USB端口并在插入新的USB存储设备时打印挂载点路径?