What is it?

Addinclude is a small utility to add an include to a header- or sourcefile, for C or C++, written in Go


Addinclude provides a simple way to add includes to header- or sourcefiles for C or C++.
Sometimes, a patch is overkill and search and replace does not cut it.
Addinclude adds the includes after the first #ifdef and preferrably together with the other #include lines.
If the header is empty, or there are no #ifdefs or #includes, the include is inserted at the top of the file.

It aims to solve a tiny problem properly instead of a thousand problems halfway, in true UNIX-spirit.
It creates a line that is very easy to read, as opposed to using sed for the same task.
It should be very clear from the syntax what is being done.
It's only one small executable, not a big package.

Which parameters are supported?

--version or -v for the current version
--help or -h for quick help
--nofix or -n to don't touch the include statement given on the commandline
--top or -t to put the include at the top
--c++ or -+ to not add .h to the include name Addinclude ordinarily only takes a filename and an include


Install the Arch Linux package with pacman -S addinclude or download the source.
There is also an older a source zip and executable for Windows.
Here's the project page.
Alexander F Rødseth 2017