Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
 help / color / mirror / Atom feed
From: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
To: ffmpeg-devel@ffmpeg.org
Subject: Re: [FFmpeg-devel] Relative paths vs. filenames in #includes for project files.
Date: Tue, 12 Mar 2024 10:53:41 +0100
Message-ID: <AS8P250MB0744B9F3BEE0C54861F919318F2B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM> (raw)
In-Reply-To: <1208424935.1763717.1710209234082@mail.yahoo.com>

Allan Cady via ffmpeg-devel:
> 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.
> 

With an out-of-tree build, there are two libavutil directories: The one
containing the source files (.c and .h) and the one for the compiled
object files. The latter also contains avconfig.h, because that depends
upon the specific configuration and is therefore also not part of the
FFmpeg repo.
With an in-tree build, there is only one libavutil directory and
avconfig.h would be reachable for the headers in libavutil/*.h via a
simple '#include "avconfig.h"', but that is not the only supported
configuration.
It is expected that the parent directory of the lib* source directories
as well as the parent directory of the lib* build directories is part of
the directories where the compiler searches for ""-includes. Just look
at the compilation command for some .o file via "make
libavutil/channel_layout.o V=1". It contains "-I. -Isrc/" for
out-of-tree builds.

- Andreas

_______________________________________________
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".

      reply	other threads:[~2024-03-12  9:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1208424935.1763717.1710209234082.ref@mail.yahoo.com>
2024-03-12  2:07 ` Allan Cady via ffmpeg-devel
2024-03-12  9:53   ` Andreas Rheinhardt [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=AS8P250MB0744B9F3BEE0C54861F919318F2B2@AS8P250MB0744.EURP250.PROD.OUTLOOK.COM \
    --to=andreas.rheinhardt@outlook.com \
    --cc=ffmpeg-devel@ffmpeg.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Git Inbox Mirror of the ffmpeg-devel mailing list - see https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://master.gitmailbox.com/ffmpegdev/0 ffmpegdev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 ffmpegdev ffmpegdev/ https://master.gitmailbox.com/ffmpegdev \
		ffmpegdev@gitmailbox.com
	public-inbox-index ffmpegdev

Example config snippet for mirrors.


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git