
On Thu, Aug 5, 2010 at 12:21 AM, Vladimir Prus
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.
I see. That is not clear at all in the documentation, including the
tutorial.
For reference, here's the code working with boost::program_options version
1.40.0:
<code>
#include <iostream>
#include <vector>
#include <string>
#include
(); for (unsigned int i = 0; i < files.size(); ++i) { std::cout << "file: " << files[i] << std::endl; }
return 0; } </code> Then compiling and running this program will result in: <shell> jeff@turing:~/test$ g++ -o args args.cpp -lboost_program_options jeff@turing:~/test$ ./args file1 file2 Declared positional options. Stored command line arguments into vm. Notified vm that all args have been parsed file: file1 file: file2 </shell>