[Geany-devel] compiling a C/C++ header (Re: C/C++ Header filetypes)

Nick Treleaven nick.treleaven at xxxxx
Thu Nov 20 12:43:50 UTC 2008

On Tue, 18 Nov 2008 21:53:47 +1100
"Lex Trotman" <elextr at gmail.com> wrote:

> I am confused about what we each mean when we are talking about
> 'build' here, and looking back I am not sure I have been consistent
> in my usage either.  So I suggest the terminology for this discussion:
> 1. Filetype commands, menu items labelled:
>  - compile,
>  - build which I suggest we call build(link) to distinguish it from
> other meanings of build and
>  - execute.

OK, I'll try to do this.

> Although having header compile as an extra filetype command can work,
> the build(link) menu item can do funny things if invoked on header
> files.  This is probably fine for an expert like Nick but could be an
> issue for a beginner just trying things out, thats why I don't like
> having commands that are not useful available to users.

OK, so this is another reason why compiling headers with an extra
command is not ideal. The other reason is that it's less natural to use
a different command.

I will try to look at your build command variants code sometime.

> > >My thoughts are that for a compile header command, this can be an
> > >_extra_ build command, so not losing compile, build, etc. As I
> > >originally said, ideally we wouldn't limit how many commands the
> > >user can run, it's up to them.
> >
> I agree that the ultimate would be to have unlimited commands, but
> that makes for a more complex configuration GUI and
> configuration/preference/project file format.  My proposal for now is
> to add one extra filetype command (compile, build(link), execute and
> spare) and one extra make command (make all, make custom, make
> object, execute and spare), remembering all labels and commands can
> be configured..

Yes, this is fine to implement a fixed number of commands now. In
future we may extend this to be unlimited. But don't worry about this.

> > >So, _if_ compiling a header is a generic command for a filetype,
> > >have an extra build command configured for the C++ filetype (and C
> > >if you want).
> As I said above I am confused about where you are suggesting this
> command to be added, as a filetype command or as a make command?

Either a filetype or a project command, depending on how the user wants
to compile headers. It sounds like you would want a filetype command to
do this, so it was only available for C documents; I would want a
project command probably because I use libraries that use pkg-config
for include file paths.

We can't use a make command because we don't know what the precompiled
header (PCH) extension is. Although that could be configurable like
'Make Object', maybe it wouldn't be so useful because people might
not want to have to add PCH targets to all their makefiles.

> Compiling headers as a project make command would be great, but I
> don't know how to set up make and other builders to compile headers
> (remember that the original reason for my build commands changes was
> to support different builders)  If there is no output file, what
> prevents make compiling all the headers every time?  Gcc leaves
> a .gch file but not all compilers do that (eg Intel C++ for Linux).

OK, out of interest, how do they record the compiled header output? In
a single cache file? If there's a file somewhere, you can write
makefile targets that depend on header file changes. But as I said,
maybe people don't want to have to add PCH makefile targets anyway,
even if it's possible.


More information about the Devel mailing list