cxxopts: my_program -DFOO=bar fails to parse

I’m running the following program:

#include <cxxopts/cxxopts.hpp>
#include <vector>
#include <string>

int main(int argc, char** argv)
{
    cxxopts::Options options { argv[0], "test program"};
    options.add_options()
        ("D,define", "description here", cxxopts::value<std::vector<std::string>>())
        ;
    options.parse(argc, argv);
}

and, when building with the master branch (or v3.0.0), I get this:

$ ./my_program -DA_LITTLE_EXTRA=1
terminate called after throwing an instance of 'cxxopts::option_syntax_exception'
  what():  Argument ā€˜-DA_LITTLE_EXTRA=1’ starts with a - but has incorrect syntax
Aborted

Despite the fact that, supposedly, #158 is fixed.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (15 by maintainers)

Commits related to this issue

Most upvoted comments

I have a fix that I will finish off in the next day.