user14767109
user14767109

Reputation:

Why can't we find the header file that actually exists?

I am a C language beginners, I encountered a problem, can not find the header file, but in fact, these header files are in the current file, I saw online methods (for example : solution) are to add - I option can solve this problem, but I am very curious, why can't it find itself, can only rely on - I option?

include path:

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

source tree:

root
 |-----test_ffmpeg.c 
 |-----include 
      

code:

#include <stdio.h>

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

int main(void)
{

    return 0;
}

compile:

gcc test_ffmpeg.c  -lavcodec -lavdevice -lavfilter -lavformat -lavutil

a fatal error occured:

test_ffmpeg.c:3:10: fatal error: ./include/libavcode/avcodec.h: No such file or directory
#include "./include/libavcode/avcodec.h"
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.

Upvotes: 0

Views: 437

Answers (1)

mr. fixit
mr. fixit

Reputation: 1552

Your include statement mentions include/libavcode, but the path that exists is include/libavcodec.

Add a c and you should see a difference.

Upvotes: 6

Related Questions