|
Boost Users : |
Subject: Re: [Boost-users] [program_options] unknown positional option
From: Vladimir Prus (vladimir_at_[hidden])
Date: 2010-08-05 00:21:21
Jeffrey Finkelstein wrote:
> I'm having some trouble using the program_options library.
>
> Here is some code slightly modified from an example in the documentation for
> boost::program_options.
>
> <code>
> #include <iostream>
> #include <vector>
> #include <string>
> #include <boost/program_options/positional_options.hpp>
> #include <boost/program_options/variables_map.hpp>
> #include <boost/program_options/parsers.hpp>
>
> namespace po = boost::program_options;
>
> int main(int argc, char ** argv) {
>
> po::positional_options_description desc;
> desc.add("files", -1);
> std::cout << "Declared positional options." << std::endl;
>
> po::variables_map vm;
> po::store(po::command_line_parser(argc, argv).positional(desc).run(), vm);
positional_options_description merely specifies translation from position to
option names. For example, the above say that every positional element of the
command line is a value of an option named 'files'. However, such option still
have to be declared in a regular way.
- Volodya
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net