GNU Gengetopt 2.19.1

This program generates a C function that uses getopt_long function to parse the command line options, to validate them and fills a struct .

Thus your program can now handle options such as:

myprog --input foo.c -o foo.o --no-tabs -i 100 *.class
And both long options (those that start with --) and short options (start with - and consist of only one character) can be handled. For standards about short and long options you may want to take a look at the GNU Coding Standards .

Gengetopt can also generate a function to save the command line options into a file, and a function to read the command line options from a file. Of course, these two kinds of files are compliant.

gengetopt is free software. Please see the file LICENSE and COPYING for details.
Notice that: Use of gengetopt does not impose any particular license on the generated code: the code generated is not under any license.

For documentation, please read this file.

gengetopt is perfect if you don't want to write all stuff required to call getopt_long, and when you have a program and wish it took options.

Generated code works if you use GNU Autoconf or GNU Automake .

Gengetopt has originally been written by Roberto Arturo Tena Sanchez  and currently maintained by Lorenzo Bettini

Gengetopt is a GNU program and its main home page is at GNU site:


You can download it from GNU's ftp site: or from one of its mirrors (see ).

I do not distribute Windows binaries anymore; since, they can be easily built by using Cygwin C/C++ compiler, available at However, if you don't feel like downloading such compiler, you can request such binaries directly to me, by e-mail (please find my e-mail address at my home page) and I can send them to you.

Anonymous CVS Access

This project's CVS repository can be checked out through anonymous (pserver) CVS with the following instruction:
cvs -z3 co gengetopt 
Further instructions can be found at the address:

Please notice that this way you will get the latest development sources of Gengetopt, which may also be unstable. This solution is the best if you intend to correct/extend this program: you should send me patches against the latest cvs repository sources.

If, on the contrary, you want to get the sources of a given release, through cvs, say, e.g., version X.Y.Z, you must specify the tag rel_X_Y_Z when you run the cvs command or the cvs update command.

When you compile the sources that you get through the cvs repository, before running the configure and make commands, you should, at least the first time, run the command:

 sh reconf

This will run the autotools commands in the correct order, and also copy possibly missing files. You should have installed recent versions of automake and autoconf in order for this to succeed. You will also need flex and bison.

NOTICE: This convention holds since release 2.14.

Changes in this release

You can also find details about new features on my blog, in this area:

On-line Manual

Return to GNU's home page.

Please send FSF & GNU inquiries & questions to . There are also other ways to contact the FSF.

Please send comments on these web pages to , send other questions to .

Copyright (C) 2001 Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA

Verbatim copying and distribution of this entire article is permitted in any medium, provided this notice is preserved.

Updated:9 Jan 2001 mhw