Advanced getopt for C++ projects


This project is an advanced getopt() class to use with your C++ projects. It handles most everything that GNU-like tools offer as far as command line options go.

The main concept is for you to have as little to do as possible to parse your command line arguments. The library expects a table of available options with a short and long version of the options, and whether they accept arguments (i.e. -f <filename>).

In your C++ program you can then just check whether a parameter is defined or not with the is_defined() and get the value as a string, an integer, etc. as required by your tool. Data verification is done automatically for basic types such as integers.


The source is available at in our project git.

You may also install it from our Snap! C++ Launchpad PPA if you run Ubuntu. In that case, add the repository this way:

sudo add-apt-repository ppa:snapcpp/ppa
sudo apt-get update

Then install one of the library packages with the install command:

sudo apt-get install libadvgetopt
sudo apt-get install libadvgetopt-dev
sudo apt-get install libadvgetopt-doc

List of currently available Snap! C++ packages.


You got a problem with the library? An idea to improve it? Please post a ticket in the Support area of


We use cmake to compile the library from source. Other than that the only requirements are standard libraries.


The libadvgetopt-doc package includes all the documentation on how to use the library. The different snapwebsites tools (under snapwebsites/src) will give you examples on how the library is used.


This library was originally developed for wpkg.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly