[FFmpeg-devel] Relative paths vs. filenames in #includes for project files.

Allan Cady allancady at yahoo.com
Tue Mar 12 04:07:14 EET 2024


To test the patch I've been working on, I wrote a small standalone C program, which I had saved in the project root. The file I'm patching is libavutil/timestamp.h. At first I had duplicated a bunch of definitions out of other include files (e.g. struct AVRational, in libavutil/rational.h) so I could run my test program in isolation, but then I decided to see if I could make it work by including the project headers, especially by including libavutil/timestamp.h.

But when I tried to compile and run it that way (I'm using Visual Studio Code with the Code Runner Extension), I got a bunch of errors that it couldn't find several files that timestamp.h depends on. I eventually figured out this was because some of the #includes in various files in libavutil are like this:

#include "avutil.h"

and others are like this:

#include "libavutil/avconfig.h"

In both of those cases, both the including and included files are in libavutil.

I changed the #includes in two files, by removing the "libavutil/", and then my program compiled. I also tested making the whole project, and it still compiled and ran fine as well.

So my question is, would it make sense to remove the path from as many of those #includes as possible, so they are filename-only? Given my limited experience, it seems like it might not be a problem, but I don't understand fully how the project manages source dependencies.

Just thought I'd toss this out for comment.




More information about the ffmpeg-devel mailing list